From: Matthew Hurd (matt_at_[hidden])
Date: 2004-02-12 02:43:30
> On Behalf Of Douglas Paul Gregor
> Subject: Re: [boost] [function] timing trivia
> On Thu, 12 Feb 2004, Matthew Hurd wrote:
> > Just completed some timings of the cost of a boost function call using a
> > boost::function<void (void)> and a raw function pointer versus inlining
> > function's code directly into the source.
> > For my circumstances (your mileage may vary):
> > Calling via raw function pointer = 314 microseconds +/- 1
> > Calling via boost function variable = 328 microseconds +/- 1
> > Only 14 microseconds of difference. Nice work, I was expecting much
> > Note: Optimised VC7.1 output, winXP 1a, Athlon 2800+ (2.09GHz)
> Looks like VC 7.1 is doing a good job optimizing this. I get asked about
> the performance of function<> every once in a while; mind if I stick this
> data in the FAQ?
These results are invalid.
I think I am embarrassing myself here... my benchmarking code is reporting
the function call overhead in proportion to the size of the loop internal to
a function :-( I'm doing something wrong here, it might be the optimizer
eliding some code due to it detecting an unused variable.
I'll investigate and report some results I'm more confident in.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk