diff --git a/doc/faq.xml b/doc/faq.xml index 395442c..652b9cc 100644 --- a/doc/faq.xml +++ b/doc/faq.xml @@ -132,6 +132,25 @@ function objects with parameters that don't exactly match. application a reference-counting allocator could be used. + + + How much overhead does a call through boost::function incur? + + The cost of boost::function can be reasonably + consistently measured at around 20ns +/- 10 ns on a modern >2GHz + platform versus directly inlining the code. + + However, the performance of your application may benefit + from or be disadvantaged by boost::function + depending on how your C++ optimiser optimises. Similar to a + standard function pointer, differences of order of 10% have been + noted to the benefit or disadvantage of using + boost::function to call a function that contains a + tight loop depending on your compilation circumstances. + + [Answer provided by Matt Hurd. See ] + +