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

libstdc++ possibly optimizes shared_ptr<T> when not linking pthreads #83

Open
gmbeard opened this issue Apr 8, 2020 · 0 comments
Open

Comments

@gmbeard
Copy link

gmbeard commented Apr 8, 2020

From the README...

Observations

[...]
C++ "ref-counted" (shared_ptr) has significant performance hit on non-Linux platforms.

Apparently, libstdc++ contains an optimization for shared_ptr<T> whereby it is able to fall back to a non-atomic reference count if it detects the absence of pthreads (source: http://snf.github.io/2019/02/13/shared-ptr-optimization/).

This could explain the performance disparity between different platforms. Should the C++ build(s) link to pthreads to disable this optimization?

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