Repository navigation
Use std::from_chars in IO::stod function - #4482
Closed
alexbeattie42 wants to merge 2 commits into
Closed
alexbeattie42 wants to merge 2 commits into
alexbeattie42 wants to merge 2 commits into
Conversation
Contributor
Author
|
As of now, |
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.
Fixes issue #3924
Brief summary of changes
Previously in this PR, I implemented the
IO::stodmethod usingstd::istringstream. Today I was working on code that processes many trials in parallel and heavily uses theTimeSeriesTableclass to read in files. In my environment it was painfully slow, and after some profiling I found it was spending most of the time inIO::stod. I implemented the same functionality usingstd::from_charswhich is much lighter and is not location sensitive for numerics (the point of the original issue). I timed it and running the same code (processing ~1200 files in parallel) produced the following results:Currently: 2,620 seconds (~43 minutes)
With
std::from_chars(this PR): 90 secondsFor this system, using
std::from_charswas around 30x faster.Testing I've completed
Looking for feedback on...
macos-15does not supportstd::from_charsfor floating point. Others have done shims for this. The clang version in themacos-26runner appears to have the support.AI/LLM use
None. Followed this cppreference example for implementation.
CHANGELOG.md (choose one)
Please review the CONTRIBUTING.md file for detailed contributing guidelines.
This change is