|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-01-29 17:36:13
"Philippe A. Bouchard" <philippeb_at_[hidden]> writes:
> "Peter Dimov" <pdimov_at_[hidden]> wrote in message
> news:000901c2c7dc$e76195e0$1d00a8c0_at_pdimov2...
>> From: "Peter Dimov" <pdimov_at_[hidden]>
>> >
>> > One easy way to estimate the impact of an optimized allocator is to
>> #define
>> > BOOST_SP_USE_STD_ALLOCATOR, to make shared_ptr use std::allocator. On
> SGI
>> > derived STLs, std::allocator is usually faster than plain new.
>>
>> I tried to do that myself but benchmark.cpp doesn't compile for me,
> there's
>> probably no timespec on Windows.
>
> I have defined BOOST_SP_USE_STD_ALLOCATOR in benchmark.cpp (gcc 2.95):
>
> Resources required by list< shifted_ptr<T> >(4000):
> Arena 0:
> system bytes = 226820
> in use bytes = 226052
> Total (incl. mmap):
> system bytes = 226820
> in use bytes = 226052
> max mmap regions = 0
> max mmap bytes = 0
> list shifted_ptr<T> took 0.0002951000 seconds to construct.
> list shifted_ptr<T> took 7.1966276647 seconds to reconstruct 2000
> times.
> list shifted_ptr<T> took 5.0495961000 seconds to copy 2000 times.
> list shifted_ptr<T> took 4.0016951000 seconds to sort 4000 times.
> list shifted_ptr<T> took 0.1382300647 seconds to swap 500 times.
> list shifted_ptr<T> took 0.0003241000 seconds to destroy.
>
> Resources required by list< shared_ptr<T> >(4000):
> Arena 0:
> system bytes = 325124
> in use bytes = 321988
> Total (incl. mmap):
> system bytes = 325124
> in use bytes = 321988
> max mmap regions = 0
> max mmap bytes = 0
> list shared_ptr<T> took 0.0004259000 seconds to construct.
> list shared_ptr<T> took 14.0157271000 seconds to reconstruct 2000 times.
> list shared_ptr<T> took 5.0331178000 seconds to copy 2000 times.
> list shared_ptr<T> took 4.0376376000 seconds to sort 4000 times.
> list shared_ptr<T> took 0.1449102647 seconds to swap 500 times.
> list shared_ptr<T> took 0.0004831000 seconds to destroy.
Would you indulge me and try the benchmark again with the enclosed
shared_count patch applied and #undef BOOST_SP_USE_STD_ALLOCATOR? I
don't really know what's going on under the covers in the SGI
allocator; this is basically just the same hack I threw at the problem
years ago.
My patch doesn't pretend to work for a threaded implementation, so
only the no-threads test applies.
-- 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