From e80a00545c6f9a2b08c1997f23a2a8b3ac47aacf Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 18 Feb 2004 06:37:13 +0000 Subject: [PATCH] Added FAQ entry from Matt Hurd about boost::function overhead. [SVN r22309] --- doc/faq.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 ] + +