Skip to content

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

@gmbeard

Description

@gmbeard

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions