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

shared_ptr optimization with local and global counters #53

Open
breese opened this issue Oct 7, 2018 · 0 comments
Open

shared_ptr optimization with local and global counters #53

breese opened this issue Oct 7, 2018 · 0 comments

Comments

@breese
Copy link

breese commented Oct 7, 2018

Would it be desirable to have a shared_ptr (or extend the existing shared_ptr) with a thread-local reference counter?

The basic idea is to have two reference counters: the normal reference counter is changed to count the number of threads using the shared_ptr, and an additional thread-local reference counter is used when a thread copies/deletes the shared_ptr (like local_shared_ptr.)

This ought to yield better performance in multi-threaded applications as it reduces the amount of cache congestion on the normal reference counter.

The disadvantages is the increased size due to the extra counter, and we need to consider how to pass shared_ptr between threads.

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

No branches or pull requests

1 participant