Repository navigation
Cache shared text shaping and glyph blobs independently of WebGPU - #50
Merged
Merged
Conversation
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.
Repeated text measurement and drawing rerun HarfBuzz shaping and recreate Skia text blobs. Cache origin-relative shaped runs and short-run text blobs so repeated labels reuse glyph data while positioning, color and rasterization remain correct. NativeTextShaping is shared by Avalonia and Uno, including CPU rendering and macOS.
Shaped runs are bounded to 2,048 entries / an estimated 4 MiB, keyed by typeface identity, text, size, scale and encoding. Short text blobs use a 512-entry LRU with styling and rasterization keys. Active readers pin blobs while drawing outside the cache lock; eviction disposes a blob after its final reader returns. Spaced/scaled drawing retains the existing positioning path. This builds on #49 and adds no WebGPU, frame-pacing or canvas-checkpoint changes.
The Linux native-package failure also exposed a GC test assumption: offering V8 idle time does not guarantee collection. Tests now complete script setup before explicitly requesting GC, observe detached nodes in scene counters before requesting collection, and verify that the count falls afterward. They avoid the five-second heap snapshot refresh interval. Low-memory notifications reschedule bounded detached-node cleanup, including batches below the 512-node mutation threshold. Certification checks wait for fresh diagnostic counters while preserving the existing batch limits. This native fix is in a separate commit.
Validation:
Probe code, methodology and raw samples are in docs/validation/text-cache.md, text-cache-windows.json and text-cache-macos.json. These are warm microbenchmark results; cold workloads, concurrent throughput and application frame rates remain unmeasured.