|
Boost : |
From: axter (boost_at_[hidden])
Date: 2006-01-04 09:14:42
This is a continuation on a thread discussion advocating replacing the boost
pointer containers with cow_ptr as the default pointer containers.
http://code.axter.com/boost_ptr_containers/maintest.cpp
http://code.axter.com/shape_test.h
http://code.axter.com/cow_ptr.h
http://code.axter.com/copy_ptr.h
The above code was used to make the comparison, and the following is the
result using VC++ 7.1 on XP with a 2G processor.
Test performance for interating through a container of pointers via [].
vector<copy_ptr<Shape> > 2.20 s
boost::ptr_vector<Shape> 3.80 s
vector<cow_ptr<Shape> > 7.20 s
Test performance for interating through a container of pointers via
iterators.
vector<copy_ptr<Shape> > 2.36 s
boost::ptr_vector<Shape> 4.11 s
vector<cow_ptr<Shape> > 6.70 s
vector<copy_ptr<Shape> > 2.31 s
boost::ptr_vector<Shape> 4.08 s
vector<cow_ptr<Shape> > 7.09 s
Test performance for initializing and copying container of pointers.
vector<copy_ptr<Shape> > 2.39 s
boost::ptr_vector<Shape> 2.81 s
vector<cow_ptr<Shape> > 0.67 s
vector<copy_ptr<Shape> > 2.84 s
boost::ptr_vector<Shape> 4.28 s
vector<cow_ptr<Shape> > 0.61 s
Test performance for populating container of pointers via factory method.
vector<copy_ptr<Shape> > 7.00 s
boost::ptr_vector<Shape> 1.55 s
vector<cow_ptr<Shape> > 3.91 s
Press any key to continue . . .
I like to see if any one can test this out on other platforms and/or
compilers to see if the results differ.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk