Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made the mem_cache_block lockfree #23

Merged
merged 4 commits into from
Jan 10, 2016
Merged

Conversation

ylow
Copy link
Contributor

@ylow ylow commented Dec 9, 2015

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 *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.
@jzmaddock
Copy link
Collaborator

This is a good idea, but the patch isn't completely portable just yet. For preference I would like a solution which:

  • Uses when BOOST_NO_CXX11_HDR_ATOMIC is not set. The code will then need to check ATOMIC_POINTER_LOCK_FREE == 2 before using atomic pointers, otherwise:
  • Uses Boost.Atomic, but checks BOOST_ATOMIC_POINTER_LOCK_FREE==2 before attempting to use atomics. Otherwise:
  • Falls back to the original implementation.

@ylow
Copy link
Contributor Author

ylow commented Dec 11, 2015

sounds good. I will update the pull request.

@ylow
Copy link
Contributor Author

ylow commented Dec 15, 2015

I have updated with the suggested checks.

@@ -19,17 +19,72 @@
#define BOOST_REGEX_V4_MEM_BLOCK_CACHE_HPP

#include <new>
#ifdef BOOST_HAS_THREADS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This include is still needed when neither not <boost/atomic.hpp> provide the functionality we require.

@ylow
Copy link
Contributor Author

ylow commented Dec 31, 2015

Sorry for the delay. I have updated the pull request with the fixes.

@jzmaddock
Copy link
Collaborator

Sorry for the delay. I have updated the pull request with the fixes.

I'm also backlogged, will get to this shortly, John.

@jzmaddock jzmaddock merged commit d8af53e into boostorg:develop Jan 10, 2016
@jzmaddock
Copy link
Collaborator

Many thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants