
lcaminiti wrote:
Thomas Heller-7 wrote:
Just did a quick test ... code is attached ...
$ time g++ -O3 -I. -Wall -Wextra add.cpp -o add
real 0m0.657s user 0m0.583s sys 0m0.067s
$ time ./add 1e+12
real 0m35.641s user 0m35.618s sys 0m0.017s
$ time g++ -O3 -I. -Wall -Wextra add_boost_phoenix.cpp -o add_phoenix
real 0m3.385s user 0m3.160s sys 0m0.217s thomas@sunshine ~/programming/local $ time ./add_phoenix 1e+12
real 0m6.648s user 0m6.643s sys 0m0.007s
This is not a fare comparison because add.cpp contains also local blocks and exits while add_boost_phoenix.cpp contains only local functions. The comparison should be made between add_boost_local.cpp and add_boost_phoenix.cpp (see below). The example names got a bit confusing and I will rename add.cpp to add_funciton_block_exit.cpp to avoid similar misunderstandings in the future.
Sorry, I didn't get the impression that there was some misunderstanding, or that the comparison was unfair. I took from that comparison that Boost.Phoenix takes 6 times longer to compile, but runs 6 times faster than Boost.Local.
A quick compile and run time comparison using Cygwin. I have ran `time` [snip] Run-Time ($ time ) --------- Boost.Local (add_boost_local.cpp) real = 0.547 s user = 0.030 s system = 0.030 s Local Classes (add_local_class.cpp) real = 0.532 s user = 0.030 s system = 0.061 s C++0x Lambas (add_cpp0x_lambda.cpp) Not available. Boost.Lambda (add_boost_lambda.cpp) real = 0.438 s user = 0.030 s system = 0.046s Boost.Phoenix (add_boost_phoenix.cpp) real = 0.500 s user = 0.030 s system = 0.046 s
These Boost.Local compile and run time performances look decent to me when compared with the other approaches (including the local class functor).
Boost.Local has the worst run time of all listed approaches. Why do you think that the performance is decent? For these attached tests, the local function seems to be called only three times. For the test from Thomas Heller, 1000000 * 10000 = 10^10 times. Thomas Heller wrote:
Are you serious? Please write real benchmarks.
Indeed, something seems very strange here. Regards, Thomas