Boost logo

Boost :

Subject: Re: [boost] [function] function wrapping with noexceptionsafetyguarantee
From: Domagoj Saric (dsaritz_at_[hidden])
Date: 2010-10-30 13:24:54


"Daniel Walker" <daniel.j.walker_at_[hidden]> wrote in message
news:AANLkTimSdhEy=bQxj=mKkJG0d48kuCpXYnQz9DK2O_A0_at_mail.gmail.com...

> So, I think the current boost::function implementation is certainly
> the right default, since many users would not appreciate doubling the
> static space overhead for a time savings of less than 10% per call.

I already explained to you that there is no 'double space overhead' with the
condition that the change is done right or the linker is able to merge
identical objects, neither of which is true in the case you posted.
The 'double' overhead you got is actually not 'double' but one unnecessary
vtable extra:
 - even in your implementation, if you assigned more (different typed)
targets to a boost::function you'd get an additional vtable for each of
those (different typed) targets...so the overhead, as said, is not double
but one extra...
 - the problem with your implementation is that you copied the original
assign() member function for your new "empty target" function copying with
it the local static vtable...to do it right the vtable must not be a local
(template) function static...

Not to mention, as also already explained in more detail (and pointed to by
Nevin), this 'overhead' of a few static pointers is completely insignificant
compared to various related code bloat issues...

-- 
"What Huxley teaches is that in the age of advanced technology, spiritual
devastation is more likely to come from an enemy with a smiling face than
from one whose countenance exudes suspicion and hate."
Neil Postman 

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