perf(studio): stop font list work from landing in drag frames - #4794
Open
miguel-heygen wants to merge 6 commits into
Open
miguel-heygen wants to merge 6 commits into
miguel-heygen wants to merge 6 commits into
Conversation
Selecting an element no longer fetches and dedupes the 1.7k-name Google font list, so the response cannot land inside a drag frame. The lists are fetched once per session on the first open.
…hen input is idle
miguel-heygen
marked this pull request as ready for review
October 1, 2026 00:42
This branch has not been deployed
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.
What
Selecting an element used to fetch both font lists, and the ~1.8k Google font names were then deduped (
uniqueFontFamilies) and scanned again withtoLowerCaseinside the font field. The response usually lands a few frames after the selection, so a drag that starts right away paid 1.4-2.9 ms of that JS inside one of its first frames.Now:
useSyncExternalStore).requestIdleCallbackslices of at most 3 ms, and input arriving between slices holds the next one back. The helper for this isrunWhenInputIdleinoverlayFrameLoop.ts, which reuses the loop's own last-input clock.Setlookup, so a selection does no list work.uniqueFontOptionsalready keeps the Google entry first.Tests
propertyPanelFont.test.tsx, "does no list work in a drag's frames when the lists land mid-drag": the lists land 200 ms into a 600 ms stream of pointermoves. It expects nouniqueFontFamiliescall until input goes idle, and exactly one after.overlayFrameLoop.test.ts, "runs idle work in capped slices, only while no input arrives".With the three source files reverted to main, all three fail. With
runWhenInputIdleturned into an immediate call, the mid-drag test fails.Measurements
These come from traces with 0.1 ms JS samples, taken on the bench fixture on a shared 32-core Linux box under load. Each case is the first drag right after selecting.
The bench's per-frame work on the first-drag rows (px, r0/r30, root, z100) does not resolve a ~2 ms change in one frame of ~40. Medians of work p95 / max, in ms:
On this box, two runs of the same build differ by up to ~1 ms per gesture, so these rows show no regression and no resolvable gain. The trace numbers above are the measurement.
Before
After