Boost logo

Boost :

From: Richard Newman (richard_at_[hidden])
Date: 2004-11-12 18:15:31

David Abrahams wrote:

> Richard Newman <richard_at_[hidden]> writes:
>> So, the new current thinking is that std::accumulate is Better than
>> simple while-loops that walk through elements which is still Bad.
>> However, boost::bind under std::accumulate is Worse. At this point, the
>> best advice is that one should use std::accumulate whenever simple
>> accumulations are needed. However, once one has to start involving
>> boost::bind on 1+-ary functions or anything else that requires new
>> run-time function redirection, then retreating back to while-loop is a
>> better performance solution.
> This all depends on your compiler's optimization capabilities. If the
> compiler can't detect that the value of the function pointer is known
> at compile-time, then yes, bind will cost you. Similarly, if it can't
> do the small object optimization, transform_iterator may cost you.
> This is the unfortunate problem of abstraction penalty in C++. If you
> want optimal performance, you can either write low-level code, improve
> your compiler, or switch to a language that supports guaranteed
> optimization (see
> Cheers,

Thank you, Dave, for replying. I will check out the link.

Do you have specific advice/experience for Linux's g++ that might improve or
explain what we're seeing here?

Kind regards,
Richard Newman
Crowley Davis Research
richard_at_[hidden] (take out the nospam. to email me directly)

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