Repository navigation
perf(renderer): record a canvas once as it opens, and measure large canvases on Android - #108
Merged
Merged
Conversation
…-tap zooms The benchmark measures canvases of 500 to 10,000 nodes, and optionally big-10000.canvas with its images (BENCH_FIXTURE_DIR). Two phases join pinch, pan and pan zoomed in: zooming in from the fitted scale to four times it and back, and a double-tap's zoom to the middle card and back. Each phase logs its window on the UI thread's clock, so frames that reached the screen can be counted outside the app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…easuring A large canvas records its Picture once it opens, holding the JavaScript thread for seconds at 10,000 nodes, and the first phase measured that. Each canvas now waits for a second of frames with none over 50 ms, and reports how long the thread was busy after the fit (busyMs). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hen they load The canvas was recorded twice as it opened, all of it and again without text for the overview, and both again when its images finished loading. On a Samsung Galaxy A15 each recording of 10,000 nodes held the JavaScript thread for 3.5 to 4 s, so a double-tap (a camera animation driven from that thread) could wait seconds after a canvas opened. The recording is now one Picture per layer (group cards, group images, edges and cards, text, file images, group labels), drawn one after another. The overview is the same layers less text, with nothing recorded again, and images that finish loading record only the two layers that draw them. What is drawn, and its order, is unchanged. A15 (release), JavaScript thread recording at open, before -> after: 2,000 nodes 1.9 s -> 0.7 s; 10,000 nodes 7.9 s -> 3.5 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Large canvases on Android, measured on a Samsung Galaxy A15 (SM-A155F, Helio G99, Mali-G57, 90 Hz, Android 16), release build. One change to the renderer: the canvas is recorded once as it opens, and only its images again when they load. Drawing is unchanged, pixel for pixel.
What the A15 shows
The benchmark's UI-thread frame rate stays at 89–90 fps throughout, but Skia replays and presents on threads of its own, so frames that reached the screen were counted outside the app (
dumpsys gfxinfofor the TextureView's window, SurfaceFlinger for a SurfaceView), with each thread's CPU time from/proc.Frames on screen per second, 4 s per phase, before → after this PR (one build, develop's recording or the new one chosen at launch):
These move by up to ±8 fps from run to run on the same build; neither column is faster. 500 nodes (develop): 42, 68, 67, 52, 51.
Real double-taps (
input taptwice) on big-10000.canvas once it has opened, six zooms in and out each: 68–86 fps during the zoom, at most 3 frames over 25 ms, with either recording.a + (0.1 − a) × 1in floating point).The change: one recording, in layers
The canvas was recorded twice as it opened (all of it, then again without text for the overview), and both again when its images finished loading. Each recording of 10,000 nodes held the JavaScript thread for 3.5–4 s on the A15.
The recording is now one Picture per layer (group cards, group images, edges and cards, text, file images, group labels), drawn one after another in the same order as before. The overview is the same layers less text, with nothing recorded again, and images that finish loading record only the two layers that draw them.
JavaScript thread held by recording after opening, A15, before → after:
(The generated canvases load one image from the web, so it arrives after the first recording; big-10000.canvas's images are beside it.)
Pixels: the develop recording and the layered one, drawn offscreen and compared byte for byte (iOS 27 Simulator, Graphite/Metal), 2,000 and 10,000 nodes, light and dark, full and overview, at scales 0.1, 0.3, 1.33 and 4: 0 bytes differ in all 32 comparisons.
iOS (iPhone 17 Pro Simulator, iOS 27, Release), UI / JS fps, develop → this branch:
macOS draws from the same recording code; it was not rebuilt for this PR.
The benchmark
BENCH_SIZES), and optionallybig-10000.canvaswith its images (BENCH_FIXTURE_DIR): the fixture is the generated 10,000-node canvas with local images.CanvasView's camera animation does).[BENCH-WIN]), so frames on screen can be counted from outside the app.Checks:
npm run typecheck,npm test(216), the example'stsc, andnpm run lint(no errors; the 7 warnings develop has).🤖 Generated with Claude Code