Skip to content

[closure segmenter] Further speed up the closure segmenter run time. #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 2, 2025

Conversation

garretrieger
Copy link
Contributor

This implements the following two changes to significantly speed up the run time of the closure segmenter:

  1. Brotli compression (used to estimated patch sizes) accounts for most of the time spent in the analysis. Reduce brotli quality from 9 to 8. Reduces run time of analysis of Noto Serif SC from approximately 45s -> 3s.
  2. Track which segments are inert (non interacting). When merging a set of segments that are all inert we can bypass closure analysis on the new segment and form the new glyph set by unioning the exclusive gids from the merged segments. This roughly halves the number of closure calls in an example analysis of Noto Serif SC. Only a minor improvement to runtime, as the closure cost is dwarfed by brotli compression cost.

Segments that are found to only have exclusive gids are inert. They don't interact with any other segments. We can utilize this to reduce the amount of closure operations needed. When merging a set of segments where all segments are inert then there is no need to do closure analysis as we can form the glyph set of the merged segment by just unioning all of the exclusive gids.

This updates the closure segmenter to track which segments are inert and skip closure analysis for those.
…estimations.

Quality 8 is significantly faster and for the purposes of size estimation is compeltely sufficient. For example switching from 9 to 8 reduces the run time of a CJK font analysis from 45s -> 3s without changing the result of the analysis.
@garretrieger garretrieger merged commit f0b8459 into w3c:main May 2, 2025
3 checks passed
@garretrieger garretrieger deleted the inert branch May 5, 2025 18:45
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.

1 participant