Boost logo

Boost Users :

From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2007-02-23 10:29:08


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

- --
Frank
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFF3whF5vihyNWuA4URAjS5AKC76qY0hkrj9zTcdHlYdtVyoKgGRACfSHYG
eqaS/cAm4ZJcMfbodwKsgRY=
=H+i0
-----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