Boost logo

Boost :

Subject: Re: [boost] [thread] thread_specific_ptr performance
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2010-01-11 14:12:38


On 01/11/2010 05:22 PM, Stefan Strasser wrote:

> even though I understand the need for it now, it still seems odd
> that we use a std::map to simply access a value in another memory segment.
>
> have you thought about dynamically allocating an index into a
> (thread-specific) vector instead of a key based on the thread_specific_ptr's
> address?
> IIUC that would allow constant-time access in all cases.

Yes, that's what I did in my patch in ticket #2361. One inconvenience
with that approach is to restrain the size of the vector if
thread_specific_ptrs are constantly created/destroyed. I did not solve
it in my patch but it should be quite doable.

I really hope Anthony will take a look at it and come up with a
vector-based solution. Or I can finish the patch myself, if it has any
chance of getting into SVN. Anthony?


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