Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-01-30 13:25:52


"Peter Dimov" <pdimov_at_[hidden]> writes:

> From: "David Abrahams" <dave_at_[hidden]>
>> "Peter Dimov" <pdimov_at_[hidden]> writes:
>>
>> > There is a test in libs/smart_ptr/test called shared_ptr_alloc_test.cpp
> that
>> > you can use.
>>
>> Your test doesn't seem to terminate for me in a reasonable amount of
>> time (minutes) in any configuration.
>
> You might need to use a lower n. Here's what I get (randomly choosing
> g++/mingw):
>
> GNU C++ version 2.95.3-6 (mingw special)
> Win32
> SGI standard library
> BOOST_HAS_THREADS: (not defined)
> BOOST_SP_USE_STD_ALLOCATOR: (not defined)
> BOOST_SP_USE_QUICK_ALLOCATOR: (not defined)
> 1048576 shared_ptr<int> allocations + deallocations:
> 1.582 seconds.
> 1.713 seconds.
> 1.702 seconds.
> 1048576 shared_ptr<X> allocations + deallocations:
> 1.151 seconds.
> 1.593 seconds.
> 1.603 seconds.
> 1048576 shared_ptr<Y> allocations + deallocations:
> 1.652 seconds.
> 1.071 seconds.
> 1.072 seconds.
> 1048576 shared_ptr<Z> allocations + deallocations:
> 1.713 seconds.
> 1.732 seconds.
> 1.722 seconds.
>
> GNU C++ version 2.95.3-6 (mingw special)
> Win32
> SGI standard library
> BOOST_HAS_THREADS: (not defined)
> BOOST_SP_USE_STD_ALLOCATOR: (not defined)
> BOOST_SP_USE_QUICK_ALLOCATOR: (defined)
> 1048576 shared_ptr<int> allocations + deallocations:
> 1.151 seconds.
> 0.961 seconds.
> 0.931 seconds.
> 1048576 shared_ptr<X> allocations + deallocations:
> 0.571 seconds.
> 0.551 seconds.
> 0.571 seconds.
> 1048576 shared_ptr<Y> allocations + deallocations:
> 0.761 seconds.
> 0.55 seconds.
> 0.54 seconds.
> 1048576 shared_ptr<Z> allocations + deallocations:
> 0.941 seconds.
> 0.921 seconds.
> 0.951 seconds.

At first I was surprised that you're seeing such a big difference, but
I guess I just overlooked them in my case, because it does show
similar results:

myjam -sTOOLS=mingw --verbose-test "-sBUILD=release <define>BOOST_SP_USE_QUICK_ALLOCATOR <threading>single" -a shared_ptr_alloc_test
...
GNU C++ version 2.95.3-5 (mingw special)
Win32
SGI standard library
BOOST_HAS_THREADS: (not defined)
BOOST_SP_USE_STD_ALLOCATOR: (not defined)
BOOST_SP_USE_QUICK_ALLOCATOR: (defined)
1048576 shared_ptr<int> allocations + deallocations:
   1.562 seconds.
   1.322 seconds.
   1.131 seconds.
1048576 shared_ptr<X> allocations + deallocations:
   0.871 seconds.
   0.691 seconds.
   0.841 seconds.
1048576 shared_ptr<Y> allocations + deallocations:
   1.001 seconds.
   0.862 seconds.
   0.611 seconds.
1048576 shared_ptr<Z> allocations + deallocations:
   1.322 seconds.
   1.152 seconds.
   1.332 seconds.

myjam -sTOOLS=mingw --verbose-test "-sBUILD=release <define>BOOST_SP_USE_STD_ALLOCATOR" -a shared_ptr_alloc_test
...
GNU C++ version 2.95.3-5 (mingw special)
Win32
SGI standard library
BOOST_HAS_THREADS: (defined)
BOOST_SP_USE_STD_ALLOCATOR: (defined)
BOOST_SP_USE_QUICK_ALLOCATOR: (not defined)
1048576 shared_ptr<int> allocations + deallocations:
   1.722 seconds.
   2.103 seconds.
   1.783 seconds.
1048576 shared_ptr<X> allocations + deallocations:
   1.502 seconds.
   1.161 seconds.
   1.462 seconds.
1048576 shared_ptr<Y> allocations + deallocations:
   1.583 seconds.
   1.623 seconds.
   1.212 seconds.
1048576 shared_ptr<Z> allocations + deallocations:
   2.073 seconds.
   1.763 seconds.
   2.123 seconds.

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

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