Repository navigation
[crater] Skip comparison when fontc output unchanged - #2114
Merged
Merged
Conversation
On average compiling a target with fontc accounts for 8% of the the runtime of crater, with the majority of the rest of the time spent in the ttx_diff python code itself: dumping the ttx and doing varoius bits of xml normalization and cleanup. This points us to an easy and significant win: avoid doing any of that ttx/xml work if fontc's output is unchanged. ttx_diff now writes the sha256 of the font it built to fontc.sha256, and takes an --expected_fontc_ttf_hash; on a match it exits 3 without comparing anything. Crater records that hash alongside the result and passes it back on the next run. A hit costs a fontc build and a hash instead of the whole comparison. Only results that describe a specific pair of fonts are cached: a runtime failure could have any cause, and if fontc did not produce a font there is no hash to key on. The cached result is only trusted when fontmake's output came from the cache in the same run, and the existing invalidation still applies (the whole cache is dropped when ttx_diff or the pinned python deps change.)
dfrg
approved these changes
Sep 3, 2026
dfrg
left a comment
Contributor
There was a problem hiding this comment.
Seems like a nice win for crater runs!
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.
On average compiling a target with fontc accounts for 8% of the the runtime of crater (with a cached fontmake output), with the majority of the rest of the time spent in the ttx_diff python code itself: dumping the ttx and doing various bits of xml normalization and cleanup.
This points us to an easy and significant win: avoid doing any of that ttx/xml work if fontc's output is unchanged.
ttx_diff now writes the sha256 of the font it built to fontc.sha256, and takes an --expected_fontc_ttf_hash; on a match it exits 3 without comparing anything. Crater records that hash alongside the result and passes it back on the next run. A hit costs a fontc build and a hash instead of the whole comparison.
Only results that describe a specific pair of fonts are cached: a runtime failure could have any cause, and if fontc did not produce a font there is no hash to key on. The cached result is only trusted when fontmake's output came from the cache in the same run, and the existing invalidation still applies (the whole cache is dropped when ttx_diff or the pinned python deps change.)