
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 segment.
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 transactions? FWIW, Asio's io_service also suffers from the computational cost of thread_specific_ptr. Would be great if those costs could be reduced. Cheers, Rutger