Skip to content

Performance fix: don't let boost promote doubles to long doubles - #968

Closed
dslarm wants to merge 1 commit into
COMBINE-lab:masterfrom
dslarm:boost_precision_966_2
Closed

dslarm wants to merge 1 commit into
COMBINE-lab:masterfrom
dslarm:boost_precision_966_2

Conversation

@dslarm

@dslarm dslarm commented Oct 23, 2024

Copy link
Copy Markdown

Fixes #966
This fix resolves performance issue where Boost::math unnecessarily promotes doubles to long double, which is not fully supported by hardware leading to slow-downs.

The change is to set a define during cmake process which prevents promotion ( -DBOOST_MATH_PROMOTE_DOUBLE_POLICY=false )

    Set boost options in CMakeLists.txt to not promote doubles to long doubles. Promotion
    incurs performance penalty on all platforms, and particularly aarch64.
@rob-p

rob-p commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

Closing as part of a housekeeping pass — with thanks; this was a real find (silent long-double promotion in Boost.Math is exactly the kind of thing nobody suspects until they profile), and the one-line policy define was the right minimal fix.

The reason for closing rather than merging: the repository's mainline is now the ground-up Rust implementation, which carries neither Boost nor the CMake build this patches, so there is no target for the change. The C++ 1.x line is frozen; anyone building it from source via the v1.10.x tags can apply -DBOOST_MATH_PROMOTE_DOUBLE_POLICY=false locally exactly as this PR describes — and this PR remains linkable as the reference for that.

@rob-p rob-p closed this Aug 21, 2026
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.

Performance issue in use of boost::math::digamma on aarch64 Linux

2 participants