Made the mem_cache_block lockfree

This *significantly* improves parallel performance of regex.
Currently if I have a large number of threads all using regexes; even if
they are using idependent regex objects, performance is still extremely poor
due to the lock inside of the mem_block_cache.
This commit is contained in:
Yucheng Low
2015-12-08 21:17:50 -08:00
parent eb729f6557
commit b9f55efe98
2 changed files with 28 additions and 48 deletions

View File

@ -192,9 +192,9 @@ BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void* p)
#else
#ifdef BOOST_HAS_THREADS
mem_block_cache block_cache = { 0, 0, BOOST_STATIC_MUTEX_INIT, };
mem_block_cache block_cache;
#else
mem_block_cache block_cache = { 0, 0, };
mem_block_cache block_cache;
#endif
BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block()