Re: [boost] Performance comparison between ptr_vectorandvector<cow_ptr<Shape> >, vector<copy_ptr<Shape> >

"Thorsten Ottosen" <tottosen@dezide.com> wrote in message news:<dprgjh$1p5$1@sea.gmane.org>...
David Maisonave wrote:
I'm not sure what you're referring to here. Can you post an example?
*ptr = *ptr2;
Can you please give a more complete example? Which is the smart pointer, here, and exactly what type of pointers?
let's assume non of the types involved are abstact.
Anyway, we have been here before and are starting to move in circles.
Even if we assume none of the types are abstract, I still don't understand what's suppose to happen in above code. What type is what in above example? By the way, I figured out why some of the results were so poor for copy_ptr and cow_ptr. Some of it had to do with assert logic, and some of it had to do with the boost pointer performing slicing. I had a derived derived class that I left out the clone function intentionally for a different test, and I mistakenly used it for the performance test. The cow_ptr still suffers in performance when populating the container compared to boost pointer. It's a approximately a two to one ratio. But the cow_ptr also still out performance the boost container by abut 4 to 1 when doing a copy of the container. I think the call to new in the cow_ptr constructor is what's making the difference when populating the container. The copy_ptr has similar results to the boost pointer container, except for the copy container test, in which it seems to out perform the boost pointer by about %20. You can download the new code via following link: http://code.axter.com/copy_ptr.h http://code.axter.com/cow_ptr.h http://code.axter.com/shape_test.h http://code.axter.com/boost_ptr_containers/main.cpp Here are the new results: Test performance for interating through a container of pointers via []. vector<copy_ptr<Shape> > 1.80 s boost::ptr_vector<Shape> 1.81 s vector<cow_ptr<Shape> > 2.06 s Test performance for interating through a container of pointers via iterators. vector<copy_ptr<Shape> > 1.80 s boost::ptr_vector<Shape> 1.77 s vector<cow_ptr<Shape> > 1.94 s vector<copy_ptr<Shape> > 1.78 s boost::ptr_vector<Shape> 1.78 s vector<cow_ptr<Shape> > 1.95 s Test performance for populating container of pointers via factory method. vector<copy_ptr<Shape> > 2.13 s boost::ptr_vector<Shape> 1.86 s vector<cow_ptr<Shape> > 3.63 s vector<copy_ptr<Shape> > 2.13 s boost::ptr_vector<Shape> 1.88 s vector<cow_ptr<Shape> > 3.66 s Test performance for initializing and copying container of pointers. vector<copy_ptr<Shape> > 28.91 s boost::ptr_vector<Shape> 36.11 s vector<cow_ptr<Shape> > 9.34 s vector<copy_ptr<Shape> > 28.38 s boost::ptr_vector<Shape> 35.70 s vector<cow_ptr<Shape> > 9.41 s
participants (1)
-
boost