|
Boost Users : |
Subject: [Boost-users] [Proto] Compialtion-time of user-defined functions : terminals vs make_expr
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2009-02-28 13:44:17
As stated in a previous thread, the question was open on what to choose
to build large number of functions inside Proto
and Eric mentionned being interested by the results .. so ;)
The choices were :
- using a terminal containing the Polymorphic Function Object of the
function and statcially instanciate it
bp::terminal< my_func_pfo > my_func = {{}};
- using make_expr in a template function
Here is the breakdown of measures I run this day using g++-4.3 and
latest proto. I used Boost::Preprocessor to generate all the code and
measured the compiel time on a streak of 100 compialtion for eahc version.
Naked main : 0.05s
Naked main w/ proto : 1.50s => overhead of proto include = 1.45s
Without Call to the actual function:
Main with 1 proto term : 1.52s => overhead = 0.02s = 0.020s/term
Main with 10 proto term : 1.55s => overhead = 0.05s = 0.005s/term
Main with 100 proto term : 1.99s => overhead = 0.49s = 0.005s/term
Main with 150 proto term : 2.55s => overhead = 1.05s = 0.007s/term
Main with 200 proto term : 3.48s => overhead = 1.98s = 0.009S/term
Main with 256 proto term : 4.80s => overhead = 3.30s = 0.013s/term
Main with 1 proto func : 1.52s => overhead = 0.02s for one function =
0.0200s/func
Main with 10 proto func : 1.53s => overhead = 0.03s for one function =
0.0030s/func
Main with 100 proto func : 1.53s => overhead = 0.03s for one function =
0.00030s/func
Main with 150 proto func : 1.55s => overhead = 0.05s for one function =
0.00033s/func
Main with 200 proto func : 1.57s => overhead = 1.98s for one function =
0.00035s/func
Main with 256 proto func : 1.61s => overhead = 3.30s for one function =
0.00043s/func
With Call to the defined functions in sequence :
func behaves like term without call (aka compilation time between 1.5s
and 4.8s)
term behaves like term without call with a linear overhead of
0.017s/call (aka compilation time between 4.5s and 9.1s)
Other measures :
executable size skyrocket with term even without any functions being called.
256 functions instanciated yields a 7.3kb binary vs a 1.4kb binary for
make_expr func
so an overhead of 23,6 bytes/functions in the case of terminal object
The scaling seems fine and make_expr is, as expected, the best contender
for large number of user-defined expression generator.
-- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net