Boost logo

Boost :

From: Bruno Lalande (bruno.lalande_at_[hidden])
Date: 2008-05-22 18:21:25

> I have to react to this. There is something called aliasing that prevent compilers to optimize, and passing builtins by const ref is generally NOT a good idea performance wise.
> There is something called the const-forwarding type that resolves to value for built-ins and const refs for UDT that might be useful here.

Usually to solve this problem I simply use call_traits::param_type, is
there any objection to this?

> Finally, something that no one seems to be concerned about in this thread, is the cost of all these templates in terms of byte object code. In such a low-level header, you can expect all these templates to end up in every UoR in your libraries, linked together into an executable. Keeping positive_ and negative_ out of your template names is going to save that many bytes in your object. You may think its nothing. I've seen placeholders (_1 to _10) defined as static const Placeholder<N> take up to .5M for essentially nothing (it's an empty class!) We saved that .5MB by declaring them extern, as is done in Boost. So the rule is: keep it as simple and short as possible while remaining readable code.

OK I'll take a closer look at how the executable size changes with the
different implementations, indeed it's a point I've forgotten a bit...


Boost list run by bdawes at, gregod at, cpdaniel at, john at