Boost logo

Boost :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2004-12-02 18:02:14


On Dec 2, 2004, at 3:03 PM, Fredrik Blomqvist wrote:

> Perhaps this could be of some interest in this discussion.
> http://www.codeproject.com/cpp/FastDelegate.asp
> The article talks about low-level optimization of delegates on a wide
> range
> of platforms.

We have to be a little careful here, because the author is using some
(really neat!) non-portable tricks.

> To quote: "Initially, I used boost::function, but I found that the
> memory
> allocation for the delegates was consuming over a third of the entire
> program running time!"
>
> Regards
> // Fredrik Blomqvist

Yes, this is a good point... one common case we had previously talked
about optimizing is everything related to:

        function<int(int)> f(boost::bind(&X::m, x_ptr, _1));

Since most slots just bind an object to the member pointer, being able
to store these in a function<> instance without allocating memory could
be a big win. I know several people have asked for it on more than one
occasion: the problem is implementing it portably (in a practical
sense; making it standard C++ is easy).

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk