fontique: add persistent cache for system font scans on macOS - #4
Open
nicoburns wants to merge 3 commits into
Open
fontique: add persistent cache for system font scans on macOS#4nicoburns wants to merge 3 commits into
nicoburns wants to merge 3 commits into
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Stacked on #3. Adds a persistent scan cache so warm app startups skip parsing font files entirely.
New
scan_cachemodule stores, per scanned file, aFileStamp { mtime_secs, mtime_nanos, size }plus the extractedFontRecords (family names, postscript name, index, width/style/weight, variation axes,CharmapIndex).ScannedCollection::from_paths_cached(paths, max_depth, cache_path)stats each discovered file, reuses cached records when the stamp matches, parses only new/changed files in parallel, and rewrites the cache when anything was parsed or a cached file disappeared:Format is a hand-rolled little-endian binary encoding (no new dependencies) with a magic number + version; any decode failure falls back to a full rescan that rewrites the cache. Writes go to a temp file + rename so readers never see a partial cache. Runtime IDs (
SourceId/FamilyId) are never persisted — they're regenerated on load.attr_axesis recomputed from the cached axes rather than stored.The CoreText backend now uses
~/Library/Caches/fontique/font-scan-cache.bin(falling back to an uncached scan ifhome_dir()is unavailable). Open question for review: whether the cache path should instead be configurable via API (e.g. onCollectionOptions, which is currentlyCopy) — happy to change the plumbing.Includes a hermetic test (using
parley_devfont assets) verifying every cached attribute round-trips identically and that changed files are re-parsed.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/60a3d833a0894a73945c806adff1cbf3
Requested by: @nicoburns