Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2004-05-05 13:14:01


Dear boosters,
In the "looping construct" thread, a while ago David Abrahams said that
we should do a test, to compare all looping solutions.

I've made such a test. It tests against:
- keeping internal functions in crange<>
- virtual functions
- BOOST_FOREACH
comparing to using raw iterators.

The tests are pretty heavy.
I've tested on a Win2000 box/512 Mb of RAM/1.8Ghz Intel processor
(laptop), VC7.1 with all optimizations on.

It seems that Dave, you were right about the virtual functions - the
vtable can be cached. But it seems to happen only when the loop contents
are pretty trivial (if within the loop there are some not-so-simple
instructions, the vtable aren't cached - see the 'set_to_az' test).

Please if any of you can spare about 15 minutes to run the tests, it
would be great! Also, any improvement to the tests is welcome.

I've attached my results and the code to test.

Conclusions (mine :D):
- BOOST_FOREACH rocks big time
- vtables can be cached, in case the instructions within the loop are
not too compilcated
- the overhead is pretty large for both vtables and internal functions
(at least for vc7.1)

I'm eager to see how the tests run on different platforms.

Best,
John

-- 
John Torjo
Freelancer
-- john_at_[hidden]
-- http://www.torjo.com/logview/ - viewing/filtering logs is just too easy!
*****************************************************************************
**                                                                         **
** WARNING:  This email contains an attachment of a very suspicious type.  **
** You are urged NOT to open this attachment unless you are absolutely     **
** sure it is legitmate.  Opening this attachment may cause irreparable    **
** damage to your computer and your files.  If you have any questions      **
** about the validity of this message, PLEASE SEEK HELP BEFORE OPENING IT. **
**                                                                         **
*****************************************************************************



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk