Repository navigation
Format HMM probabilities without printf in printprob - #22
Closed
kevinmoran1988 wants to merge 1 commit into
Closed
kevinmoran1988 wants to merge 1 commit into
kevinmoran1988 wants to merge 1 commit into
Conversation
bathbuild spends much of its write time in glibc's exact %.5f path. A float times 1e5 is exact in double, so rint() gives printf's rounding; format the digits directly and fall back to fprintf otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kevinmoran1988
force-pushed
the
hmmfile-fast-prob-format
branch
from
September 25, 2026 23:42
e52197a to
7494a0c
Compare
Collaborator
|
Thanks for the profiling work here. I'm going to pass on this one — not because anything looks wrong, but because I don't think the benefit is worth the added complexity. This replaces a single, well-understood Appreciate you digging into this and sharing the numbers either way. |
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.
printprob() writes every emission and transition probability as " %8.5f" of -log(p), and glibc's exact-decimal %f path is 8-10% of bathbuild's profile. A float times 1e5 is exact in double, so rint() of that product rounds exactly as printf does, ties to even included. format_prob() builds the digits directly and printprob() writes them with fwrite(). Zero probabilities still print "*" through fprintf, as does anything non-finite or out of range.
Checked exhaustively: all 2,139,095,039 positive floats format byte-identically to glibc's snprintf(" %*.5f").
bathbuild over 5232 dipteraODB12 alignments, serial, 3 runs each, in seconds:
base 230.97 / 232.23 / 229.27
patch 224.54 / 223.97 / 222.84 (1.03x)
Output byte-identical to base on that corpus.
🤖 Generated with Claude Code