Skip to content

Optimize rendering and runtime weight without removing Visualizer features - #5

Open
danielhjeffery wants to merge 11 commits into
mainfrom
codex/visualizer-rendering-optimization
Open

Optimize rendering and runtime weight without removing Visualizer features#5
danielhjeffery wants to merge 11 commits into
mainfrom
codex/visualizer-rendering-optimization

Conversation

@danielhjeffery

@danielhjeffery danielhjeffery commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Scope

Two incremental maintenance passes on existing v1.12.8, based on main 96fe31c7f112083f6aea652689b01411979f49c0. No rebuild, UI redesign, new styles, version bump, preset migration, project-schema change or dependency addition. Existing mappings, quality settings, formats and exact export renderer remain in place. Main is unchanged; this PR is not auto-merged.

Current second-pass head: bac4446aa6ffd33cedcbaedf17211f30ade63fec.

First pass — rendering work and correctness

  • Vectorize the original Catmull–Rom formula; avoid discarded preview meshes and history-sized sampling allocations; cache scene coordinates.
  • Keep bounded smooth paths connected while preserving filtered-source gaps.
  • Honor points-only, head/halo/flash sizing and HUD controls; refine at the latest playback time.
  • Validate/copy aligned live buffers, skip disabled stage captures, include existing stage/updater modules in wheel packaging.
  • Add 11 regression tests, a reproducible preview benchmark and Linux/Windows/Apple Silicon/Intel macOS quality checks.

The first-pass controlled raster benchmark measured 156.601 → 29.388 ms per frame. That result and its workload are recorded in docs/RENDERING_OPTIMIZATION.md; it is not a general app multiplier.

Second pass — lightweight without feature loss

  • Share a single full-resolution current-frame raster between the viewport and stage consumers. Complete source/time/camera/options/style/font/size/DPR invalidation; copied pixmaps cannot corrupt the retained frame.
  • Cap extra viewport cache pixel payload at 32 MiB. Oversized frames use the original full-resolution direct paint path, not reduced resolution/density.
  • Blit scientific cursors and foreground artists in original draw order instead of repainting entire plots. Per-panel extra background cache has an 8 MiB ceiling and full-render fallback.
  • Defer hidden plot construction until a tab, draw or stage layer needs it. Latest source and cursor time are retained. Collapsed plots stop unnecessary redraw work, not data/time updates.
  • Create stage video decoding only for video backgrounds; pause timer/video when hidden/minimized, restore on show and release on replacement/close. Solid-color/image modes no longer allocate unused video players.
  • Add 12 focused regression tests and tools/benchmark_lightweight.py. No quality or FPS defaults reduced.

Second-pass measurements against first-pass source

Sequential separate processes, same Linux offscreen host and libraries; 100,000 source rows, 1,200 live points, smooth detail 4, 960×600 viewport, DPR 1, 20 samples after three warmups.

CPU operation First pass Second pass
New viewport frame 41.260 ms 41.018 ms
Three repeated same-state captures 122.482 ms 0.152 ms
New frame + three captures 164.436 ms 41.178 ms
Spectrogram cursor update 45.784 ms 1.444 ms
Mapped-trace cursor update 39.585 ms 10.639 ms

Initial Source-tab plot preparation retained 52,524,815 → 9,888,654 Python-tracked bytes. This is not total application RAM/RSS: fixtures were allocated before tracing, native Qt memory is not fully tracked, and caches add bounded native memory. New-frame cost is essentially unchanged; gains come from avoiding repeated work. No GPU/FPS guarantee or executable-size reduction is claimed. Details: docs/LIGHTWEIGHT_RUNTIME_PASS.md.

Validation

  • First-pass local baseline: 113 tests, 111 pass / 2 macOS-only skips.
  • Second-pass local full suite: 125 tests, 123 pass / same 2 skips.
  • The 12 new tests also pass at Qt scale factors 1.5 and 2.0; no old test removed or relaxed.
  • Exact pixel comparisons cover cached/direct viewport and normal full redraw versus cursor blitting for waveform, spectrogram, chromagram, MFCC and mapped traces, including legends/spines.
  • Local compile/import checks pass. Local older Ruff 0.12.12 uses the previously documented UP038 exclusion for unchanged legacy code; hosted CI uses current Ruff without that exclusion.
  • Hosted blob hashes were compared with the exact tested local source before publication. Temporary preparation files/workflows are absent from the final source tree. Final OS-check results must be read from the current head, not inherited from the first-pass green run.

Explicit boundaries

No GPU renderer enabled. Hardware encoding is not GPU scene rendering. Live labels/colorbar/ghost-path parity and moving-viewport DPI cap remain documented work, not removed controls or completed claims. No physical GPU/audio-device or signed-installer certification.

Review Files changed and the current checks. Squash merge is recommended to collapse temporary preparation history; this PR remains unmerged.

Preserve v1.12.8 UI, presets, and exact export behavior. Vectorize spline math, skip discarded preview meshes, bound allocations, keep sampled paths connected, honor controls, synchronize pause refinement, validate live buffers, skip disabled stage grabs, and complete wheel module declarations.

Add 11 regression tests, reproducible CPU benchmark, four-platform CI, and a GPU/remaining-gap assessment. Linux local and hosted validation: 113 tests, 111 passed and 2 macOS-only skips. Hosted Ruff, compile and source checks passed. No GPU renderer or physical-hardware certification claimed.

Remove temporary patch-transfer files and validation workflows from the final tree.

Copy link
Copy Markdown
Contributor Author

Final verification for head 83151d21325c76b18a3ebc4496a77164968ec6be: the four-platform PR quality run 34438871891 is green on all four runners.

Runner Static / compile / imports Unit + integration suite Offscreen app startup
Ubuntu 22.04 x86_64 Passed Passed Passed
Windows 2022 x86_64 Passed Passed Passed
macOS 14 Apple Silicon Passed Passed Passed
macOS 15 Intel Passed Passed Passed

Run: https://github.com/MetriqOrg/Metriq-Visualizer/actions/runs/34438871891

The local suite also completed: 113 tests, 111 passes and the same 2 macOS-only skips as the untouched Linux baseline. The measured CPU preview result remains 156.601 ms → 29.388 ms median for the documented controlled workload. This does not certify physical GPUs/audio devices or signed desktop installers, and no GPU renderer was enabled.

PR remains unmerged; main is unchanged.

Share a bounded full-resolution current-frame cache with stage output; repaint cursors rather than entire scientific plots with original foreground ordering; defer hidden analysis panels until viewed or used; load stage video decoding only when requested and release it on close. Preserve existing presets, controls, density, timing, data formats and exact export renderer.

Add 12 regression tests, a reproducible lightweight-runtime benchmark, and detailed cache/measurement limits. Local full suite: 125 tests, 123 passed and 2 macOS-only skips. Focused suite also passes at 1.5x and 2x scale. Hosted OS checks apply to this final revision separately.

Remove temporary source-preparation workflow from the final tree. No new dependency, GPU backend, version bump, or installer-size reduction.
@danielhjeffery danielhjeffery changed the title Optimize realtime rendering without changing the Visualizer UI Optimize rendering and runtime weight without removing Visualizer features Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Second-pass final verification

Head bac4446aa6ffd33cedcbaedf17211f30ade63fec has passed the four-platform PR quality run 34489886120: Linux x86_64, Windows x86_64, Apple Silicon macOS and Intel macOS. Static analysis, compilation, source/import checks, the unit/integration suite and offscreen application startup passed on each platform.

Run: https://github.com/MetriqOrg/Metriq-Visualizer/actions/runs/34489886120

The local full suite completed 125 tests: 123 passed, with the same two macOS-only skips as the Linux baseline. All 12 new focused tests passed locally at scale factors 1.0, 1.5 and 2.0. Pixel comparisons preserved full-render output across all five scientific panel modes. No existing test was removed or relaxed.

The controlled second-pass measurements remain: new frame + three repeated captures 164.436 → 41.178 ms, spectrogram cursor 45.784 → 1.444 ms, mapped-trace cursor 39.585 → 10.639 ms. New-frame generation itself is essentially unchanged. Python-tracked retained plot-preparation allocations were 52,524,815 → 9,888,654 bytes, not a total RAM claim. No resolution, density or frame-rate defaults were lowered; no feature or dependency was removed.

All eight second-pass published source blobs match the tested local hashes. The combined offline patch was applied to a clean original-source snapshot and all 14 resulting changed/added files matched the final source byte-for-byte. Temporary preparation workflow is absent from the final tree.

Main remains 96fe31c7f112083f6aea652689b01411979f49c0; PR is unmerged. No new GPU renderer, smaller installer, physical-device certification or release deployment is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant