|
Boost Users : |
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2007-02-23 10:55:21
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Friday 23 February 2007 10:29 am, you wrote:
> On Friday 23 February 2007 09:53 am, you wrote:
> > On Friday 23 February 2007 09:24 am, Peter Dimov wrote:
> > > Have you actually run a test and observed a 50x slowdown? You can
> > > use libs/smart_ptr/test/shared_ptr_timing_test.cpp.
> >
> > I get:
> >
> > fhess_at_humidor:~/cvs/boost/libs/smart_ptr/test$ g++ -Wall -O3
> > shared_ptr_timing_test.cpp
> > fhess_at_humidor:~/cvs/boost/libs/smart_ptr/test$ ./a.out
> > 0.22
> > fhess_at_humidor:~/cvs/boost/libs/smart_ptr/test$ g++ -Wall -O3
> > shared_ptr_timing_test.cpp -pthread
> > fhess_at_humidor:~/cvs/boost/libs/smart_ptr/test$ ./a.out
> > 1.87
> >
> > With boost 1.32,
> > $ gcc --version
> > gcc (GCC) 3.3.5 (Debian 1:3.3.5-13)
> > on a 3.2GHz pentium d.
>
> For further comparison, I modified the test to use an ordinary int*
> instead of a shared_ptr<int>, and got:
>
> g++ -Wall -O3 raw_ptr_timing_test.cpp
> fhess_at_humidor:~/cvs/boost/libs/smart_ptr/test$ ./a.out
> 0.08
>
> So it's about x3 slower using shared_ptr without -pthread, and about x20
> slower using shared_ptr with -pthread.
And to round it out, compiling against a boost cvs checkout gives a x10
slowdown, with the -pthread option making no difference:
fhess_at_humidor:~/cvs/boost/libs/smart_ptr/test$ g++ -Wall -O3 -I ~/cvs/boost
shared_ptr_timing_test.cpp
fhess_at_humidor:~/cvs/boost/libs/smart_ptr/test$ ./a.out
0.81
- --
Frank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFF3w5q5vihyNWuA4URAr7KAKCiTALn+p0wPXCg+MCLtZJkFk0B6wCgpJPp
8xpW0DS2MxByXTHKTw4KT74=
=cLYX
-----END PGP SIGNATURE-----
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