Expose the native widget surface through ordinary typed TSX components and enforce application composition at generic export and entry boundaries. Migrate maintained screens, scaffolds, gallery publication and editor transport through the common checked IR path. Preserve native logic, retained component state, input and platform hosts; remove the pixmap application route. Local validation: complete make push-check passed with published Ziran dc3ecf0a, including docs, public source/saved surface, private-display desktop input, native host links and Canvas input parity. Fresh CLI/player/desktop library installed and byte-verified. The full migration matrix records remaining owning suites, published consumer pins, platform runs and Alpha benchmarks; this is a source milestone, not completion of the full campaign.
10 KiB
Repeatable performance checks
python3 tools/performance.py builds an optimized native, display-free runner
and measures four workloads at 960 × 600 pixels: a scrolling 10,000-item list,
an 8 KiB wrapped Unicode document, 144 images, and 20 idle controls. Each has
10 warmup frames followed by 60 measured frames. Reported values include
submission, combined commit/raster and total median/p95 times, nodes, paint
commands, raster emissions, damage pixels, workers and runner peak RSS.
The idle workload must emit zero unchanged paint commands.
Use a same-machine baseline for a regression gate:
python3 tools/performance.py --output backup/performance-baseline.json
python3 tools/performance.py --baseline backup/performance-baseline.json --max-regression 0.20
Comparison rejects mismatched hardware, compiler command, optimization,
viewport, warmup or requested worker count. A p95 regression fails when it
exceeds the percentage and adds more than 0.2 ms. --budget-ms 64 provides an
absolute p95 ceiling for every workload; CI uses this generous ceiling to
catch large regressions across shared runners. Local baselines give a tighter
check on fixed hardware. The JSON retains check results and failures.
The build directory is stable and locked for the whole run. Desktop variables
are scrubbed. RSS comes from the native runner's /proc/self/status VmHWM
after the measured frames. Unlike a launcher's wait4 high-water mark, it
excludes the Python process's memory before exec. Schema 2 baselines use this
measurement. The timings
exclude warmup; the runner CPU-seconds counter includes initialization and all
warmup/measured frames, and excludes compilation and the Python launcher. Timings
cover the pixmap pipeline, not native window presentation, asset decoding,
screen-reader overhead, process idle wakeups or GPU/browser rendering.
The widget review harness measures actual public controls, rather than mock faces. It includes the core gallery scenes plus light and dark system-palette compositions. Each interactive scene captures resting, disabled, hover, keyboard focus and held-press states, using the same 480 × 320 viewport.
taskset -c 2 python3 tools/widget-review.py before
# Change the shared library after the baseline finishes.
taskset -c 2 python3 tools/widget-review.py after
taskset -c 2 python3 tools/widget-review.py compare
taskset -c 2 python3 tools/widget-review.py recheck --trials 7
The stable executables and disposable generated C live under
build/scratch/widget-review/. Captures, bounded per-frame CSV, JSON metrics and
comparison PNGs live under ignored backup/material-widgets/. Desktop results
use comparison-desktop/grid-overview.png and full-size state comparisons.
A second baseline replaces the previous baseline, so preserve any earlier study
before starting another.
Use --output-dir backup/material-widgets/navbar or
--output-dir backup/material-widgets/perf for an independent study; this also
selects that study's fixture image. --scenes 20 limits a capture to the
NavigationBar. Keep previous studies in place instead of reusing their output
directory. The normal executable paths stay stable.
Cairo retains up to eight owned Pango layouts for alternating labels and font sizes; long editor runs share one slot. Layouts are released when the raster closes or resizes. Retained paint text uses 512-byte snapshot blocks, so a short frame initially reserves 4 KiB instead of 32 KiB while larger frames still grow without truncation. Pixmap fills opaque spans in bounded groups of four pixels; the translucent rounding and coverage remain unchanged. Validate memory with both peak heap allocation and RSS: small heap savings need not reduce the process's resident high-water mark on every run.
Both hosts run 10 warmup and 120 measured frames for each state and mode. Retained mode tests that unchanged frames emit no raster commands. Forced repaint invalidates the paint snapshot before every frame and includes widget composition, commit, rasterization and, for desktop, SDL texture upload/presentation. Timings include monotonic wall time and process CPU time. They are CPU-side measurements, not GPU timestamps or input latency. The desktop uses SDL's software presentation on private Xvfb; the pixmap uses its actual CPU raster and bundled font outlines. The fixture image is identical on both hosts.
Runner /proc/self/status supplies peak and steady RSS after warmup/measurement;
it excludes the Python launcher. Steady RSS can exceed an earlier high-water
sample by a page when the status reader itself faults a page. Startup is the
in-process interval from runner entry through its first complete frame, including
host setup and font work, but excluding the OS executable loader and compilation.
Binary size and its SHA-256 are recorded with the samples. The text reservation
counter covers reusable frame-owned label/path storage, not total memory.
The comparison JSON gives medians across scene/state cases and the largest
observed process high-water RSS across both modes. It flags per-case timing
increases above both 5% and 0.025 ms for investigation; repeat flagged cases to
distinguish reproducible costs from shared-machine variation. recheck runs each
flagged case three more times with the recorded after executable (verified by
SHA-256), preserves the initial samples, and fails for a confirmed increase in
the median of the repeats. Raw repeats and their summary stay beside the captures.
Use recheck --backend desktop --trials 7 for a longer investigation on a noisy
shared machine; this keeps the same threshold and records all seven trials.
For close comparisons pin both phases to the same single allowed CPU core, as above, to avoid migrations between differently loaded cores.
Idle CPU covers a 200 ms quiet interval with five 40 ms sleeps and, on desktop, its ordinary event poll; no frames are submitted in that interval. Together with zero retained raster emissions this tests the harness's idle behavior, rather than claiming that every downstream application's event loop sleeps. No renderer thread, timer or animation is added by the default style. CPU affinity is recorded. All captures use private Xvfb with inherited display/auth/session variables scrubbed and desktop recovery disabled. This does not measure Android hardware, a physical GPU, a desktop compositor, browser behavior or terminal-cell fidelity.
The GPUI reference uses the same five 480 × 320 scene families in a disposable
Cargo project pinned to GPUI 0.2.2 and libc 0.2.186. Its default measurement
covers GPUI TestAppContext root render/layout/prepaint/paint only; it does not
execute GPU work, present a frame or include compositor wall time, and therefore
is not interchangeable with Kryon's compose-only or hardware presentation phases.
python3 tests/gpui_render_benchmark.py \
--trials 3 --warmup 120 --frames 120 \
--output work/backend-render-benchmark/gpui-render-benchmark.json
python3 tests/gpui_render_benchmark.py --gpu-probe \
--device /dev/dri/renderD129 --trials 3 --warmup 120 --frames 120 \
--output work/backend-render-benchmark/gpui-render-benchmark-gpu.json
The second command starts a private headless Weston GL instance on the selected
AMD render node. GPUI 0.2.2 currently requires the Wayland wl_seat global;
headless Weston has no seat, so the report records the exact client unwrap
limitation instead of presenting an unsupported CPU-to-GPU comparison. Generated
Cargo inputs remain under build/scratch/gpui-render-benchmark, while reports and
logs remain under ignored work/backend-render-benchmark/.
Renderer performance benchmark
Run build-queue -- python3 tests/scene_render_benchmark.py --output PATH
on Linux. The benchmark enables POSIX_THREADS; ZIRAN_PAR_THREADS=1 selects
the same renderer serially. CC can select a compiler wrapper. The benchmark
retains four MSAA samples per pixel and the complete 960x600 and 420x900 output. It measures
clear/resolve, unlit meshes, textured meshes, a 12-instruction programmable
material, and standard lit meshes. The texture is 1024x1024; the scene has a
wall and four rounded boxes. Each workload warms once, then measures three
camera positions. Geometry construction and full-frame hashing are outside
the timed region. Rows contain width, height, workload, frame, wall nanoseconds,
process CPU nanoseconds and an RGBA pixel hash. CPU time separates rendering
work from scheduling delays; it does not predict an application's frame rate.
Use --compare PATH with an earlier output to require all 30 pixel hashes to
match and report median speed ratios. Add --motion for 120 changing-camera
frames per workload at 960x600, 420x900 and 1280x800. It reports p50/p95/p99,
the count within the 16.67 ms budget, cold render time, retained scratch and
sampled process peak RSS/HWM; it also checks all 1,800 motion hashes when the
comparison contains them. Every sample is retained, including slow frames.
--shadows instead adds 120 motion frames at each resolution for a lit
programmable material, a 1024-square shadow map and the unchanged five-tap
soft-shadow disk. Compare against an earlier --shadows output to check all
360 shadow hashes. The original 30 reference frames still run in this mode.
--overdraw instead adds 16 opaque lit programmable planes, with 12 changing
camera frames at each resolution after warming that camera path's clipping
capacity. Compare against an earlier --overdraw output to check all 36 motion
hashes. Statistics rows record the final frame's projected layers, visibility
pass choice and material evaluation counts.
The benchmark checks fixed scratch capacity during these camera motions and
zero scratch after release. It measures rendering only: presentation, image
uploads and application geometry/state updates require application profiling.
These are local tests, not GPU timings or application frame-rate claims.
The renderer reuses sized scratch buffers, converts fragment output once for its covered samples, and caches the exact byte-to-linear transfer. The output lookup searches thresholds generated from the original transfer and rounding; it does not reduce color precision. Shader vector arithmetic dispatches once per instruction. These changes retain clipping, blending, depth and sampling behavior; the shader regression renders both sides of every output-byte edge.