|
Boost : |
From: Douglas Gregor (doug.gregor_at_[hidden])
Date: 2006-01-09 09:38:01
On Jan 9, 2006, at 7:18 AM, Peter Dimov wrote:
> Douglas Gregor wrote:
>
>> So, Peter, any chance of getting a slightly more optimized Boost.Bind
>> that can fit boost::bind(&Test::func, &func, _1) into 12 bytes?
>
> I can't think of an easy way to do that at the moment (compress all
> placeholders to not take up space).
Well, there's compressed_pair<F, compressed_pair<arg1_type,
compressed_pair<arg2_type> > >...
> Even if I did, bind(&X::f, &x, _1, true) would still overflow the
> 12 byte
> buffer. ;-)
Why? Does it need more than the 8-byte member pointer and 4-byte
pointer?
> One hack-ish solution would be to increase the buffer to 16,
> possibly even
> 32, and try the measurements again. This of course has obvious
> drawbacks for
> people that use only function<> without bind.
Much of my earlier whining about implementing the SBO in
boost::function is that I've been trying to keep the overhead down. I
think at it's current state with the 12-byte buffer, it's at the
right balance point between execution time and space overhead
(assuming we can trick bind into smashing those binders into 12 bytes
<g>).
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk