$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [local] Help for the Alternatives section
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2011-03-28 13:03:46
Thomas Heller-7 wrote:
> 
> On Monday, March 28, 2011 05:25:13 AM Jeremy Maitin-Shepard wrote:
> > On 03/26/2011 03:19 PM, Lorenzo Caminiti wrote:
> > > Hello all,
> > >
> > > I am updating Boost.Local docs and I could use a some help in
> getting
> > > the Alternatives section right
> > > 
> http://svn.boost.org/svn/boost/sandbox/local/libs/local/doc/html/boost_local/Alternatives.html
> > 
> > You might include compile time and run time benchmarks, information 
> > about error message quality, and polymorphic capabilities. 
> > Additionally, you might note that with C++0x local classes can be
> used 
> > with templates.
> 
> 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_at_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.
A quick compile and run time comparison using Cygwin. I have ran `time` 3
times and I am reporting the result with the middle `real` value. I will get
more statistically meaningful results (avg and std-dev over 100
executions...) and on a real Linux system.
Compile-Time ($ time g++ -O3 -Wall -Wextra -I... )
-------------
Boost.Local (add_boost_local.cpp)
    real    =  6.188 s    user    =  0.885 s    system  =  1.495 s
Local Classes (add_local_class.cpp)
    real    =  3.828 s    user    =  0.525 s    system  =  0.464 s
C++0x Lambas (add_cpp0x_lambda.cpp)
    Not available.
Boost.Lambda (add_boost_lambda.cpp)
    real    =  5.515 s    user    =  0.948 s    system  =  1.136 s
Boost.Phoenix (add_boost_phoenix.cpp)
    real    = 12.641 s    user    =  3.619 s    system  =  3.074 s
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).
--Lorenzo
http://boost.2283326.n4.nabble.com/file/n3412415/add_boost_local.cpp
add_boost_local.cpp 
http://boost.2283326.n4.nabble.com/file/n3412415/add_local_class.cpp
add_local_class.cpp 
http://boost.2283326.n4.nabble.com/file/n3412415/add_cpp0x_lambda.cpp
add_cpp0x_lambda.cpp 
http://boost.2283326.n4.nabble.com/file/n3412415/add_boost_lambda.cpp
add_boost_lambda.cpp 
http://boost.2283326.n4.nabble.com/file/n3412415/add_boost_phoenix.cpp
add_boost_phoenix.cpp 
-- View this message in context: http://boost.2283326.n4.nabble.com/local-Help-for-the-Alternatives-section-tp3408469p3412415.html Sent from the Boost - Dev mailing list archive at Nabble.com.