Subject: Re: [boost] [thread] thread_specific_ptr performance (was: Re: Boost library submission (poll for interest))
From: Rutger ter Borg (rutger_at_[hidden])
Date: 2010-01-09 06:48:39
Stefan Strasser wrote:
> implementing this requires a call to thread_specific_ptr::get() on each
> operation to obtain the active transaction.
> unfortunately thread_specific_ptr is implemented using pthread calls and a
> std::map lookup, so this consumes > 6% CPU in one of my test cases.
> and this is a real world test case with other expensive stuff, in cases
> that e.g. only read cached objects it's probably even worse.
> is there any chance for a thread_specific_ptr implementation based on GCC
> __thread and MSVC __declspec(thread)?
> __thread results in a simple read access using a thread-specific memory
Isn't this under the assumption that such a container should be thread-safe
by default? Isn't that requirement orthogonal to the semantics of
FWIW, Asio's io_service also suffers from the computational cost of
thread_specific_ptr. Would be great if those costs could be reduced.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk