Repository navigation
Conversation
Three caches in Rune's vendored parley_engine (vendor/parley_engine.patch, beside the UAX #9 L1 fix), each for work shaping repeated from identical inputs: - Analyzer keeps the ICU line and word segmenters it made (analysis.rs Segmenters). Making one looked up its rules and, with complex-scripts, loaded the dictionaries, for every text. The segmenters are 'static and Copy, so a kept one is the value a new one would be. - Shaper keeps each run's font metrics per font instance and size (run_metrics_cache, an LRU of 16 beside its shaper caches), instead of skrifa::Metrics::new for every run. - FontMetrics::from_font_instance, which parley's style metrics call once per style per layout, keeps its answers per thread (64 entries, keyed by blob id, index, synthesis, size and variations). Proof, every layout of 7 screens x 11 UI languages (en ar he ja zh ko th km my hi ru; 5,933 texts), a digest of each finished layout (line boxes, runs, fonts, sizes, coordinates, every glyph's id and position, clusters, inline boxes): 0 differ, each cache alone and together. Warm cost per Parley build, the three variants interleaved in one batch: 25.8 us a text -> 24.4 (segmenters) -> 22.1 (and metrics), 14.3% less. A returning user's launch (tabs10, release, visible desktop, n=9): the texts shaped between the first frame and live content 9,433 -> 7,254 us p50, those before the first frame 1,897 -> 1,689.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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.
Rune's vendored
parley_enginestops redoing three pieces of shaping work from identical inputs. Layouts are unchanged; a text's shaping takes 14% less.Analyzerkeeps the ICU line and word segmenters it made. Making one loaded the complex-script dictionaries again for every text.Shaperkeeps each run's font metrics per font instance and size (an LRU of 16 beside its shaper caches), instead ofskrifa::Metrics::newper run.FontMetrics::from_font_instance(parley's style metrics call it per style per layout) keeps its answers per thread, 64 entries.Proof
vendor/parley_engine.patchis regenerated from the published crate plus the whole vendored tree (it applies cleanly to parley_engine 0.12.0 and reproducesvendor/parley_engine/src).