Avoid unnecessary fractional scans in exact conversion - #402
Open
perfloop-agent wants to merge 2 commits into
Open
Avoid unnecessary fractional scans in exact conversion#402perfloop-agent wants to merge 2 commits into
perfloop-agent wants to merge 2 commits into
Conversation
perfloop-agent
force-pushed
the
perfloop-pr-open-f5be9f04qk
branch
from
August 11, 2026 22:36
889f050 to
0097a06
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When exact conversion has already found a nonzero discarded integer digit, skip scanning the fractional span for another truncation signal that cannot change rounding. The fractional scan remains in place when the discarded integer suffix is all zero, where it is still needed. The change affects only the rare digit-comparison fallback and adds a focused mode to the existing benchmark for this path.
Performance
On workload
direct parse_mantissa: 770-digit integer with a nonzero discarded suffix and a 4 MiB zero fraction, median metricns/opchanged from 220801 to 928; paired median delta -219875 (-99.6% of baseline; at least 19/20 confidence interval -226131 to -215201 from 10 pairs).On workload
public from_chars exact fallback: 770-digit integer with a nonzero discarded suffix and a 4 MiB zero fraction, median metricns/opchanged from 2287640 to 2028719; paired median delta -265772 (-11.6% of baseline; at least 19/20 confidence interval -273683 to -246648 from 10 pairs).Testing
Ran the Release CMake test suite, the C++20 constexpr basictest, clang-format 17, and the repository benchmark modes. Focused coverage exercises direct mantissa parsing and public from_chars conversions with zero and nonzero discarded integer suffixes, fractional-tail variants, and the exact-conversion route.
All 4 declared correctness checks passed.
Authored and verified by Perfloop: every claim above was co-measured on both trees and independently re-verified before submission — the full record is public: case_9k6jbbrrax. Replies from this account are human-approved, and a human operator is accountable for this contribution.