Repository navigation
[Performance] Batch one: skip the empty Gaussian pass, animation pause flag, lazy error names, unfair lock on component ids - #54
Draft
miogds wants to merge 1 commit into
Conversation
miogds
force-pushed
the
feature/perf_batch1
branch
2 times, most recently
from
September 20, 2026 20:22
82b60d2 to
34f813b
Compare
miogds
force-pushed
the
feature/perf_batch1
branch
from
September 20, 2026 20:42
34f813b to
0e0c10d
Compare
This was referenced Oct 3, 2026
Draft
…ths and component-id lookups Three small, behaviour-preserving changes from the hot-path survey in docs/proposals/PerformanceMeasurementResearch.md (C7, C16, C3): - AnimationSystem: the update loop read each entity's pause state through isAnimationComponentPaused(entityId:), which walks the entity's subtree allocating a Set and an array per node with a scene.get per node, every frame, to answer a Bool the loop already holds. Read animationComponent.pause directly; the public API is unchanged. - ErrorHandlingSystem: the entity-taking handleError overloads formatted the entity name before the logger's level check. Build the message inside Logger.logError's autoclosure so per-entity call sites in the draw loop and culling pay nothing unless the error is logged. - ComponentPool: the component type-to-id map, read on every scene.get, now sits behind an OSAllocatedUnfairLock instead of an NSLock; it only changes when a new component type registers.
miogds
force-pushed
the
feature/perf_batch1
branch
from
October 16, 2026 14:34
da8ed5a to
ef201da
Compare
miogds
force-pushed
the
feature/perf_counters
branch
from
October 16, 2026 14:34
4bb0bb5 to
51873ca
Compare
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.
First optimization batch from
docs/proposals/PerformanceMeasurementResearch.md, stacked on #53 so the benchmark can measure it. Fork-only; nothing goes upstream until the whole effort is done.Changes
gaussianCoverageWrittenstays false, so the composite and anti-aliasing passes do not read the stale map. Verified on macOS that the pass and its depth copy appear only in the Gaussian scene.isAnimationComponentPaused(entityId:), which walks the entity's subtree allocating aSetand an array per node with ascene.getper node, every frame, to answer aBoolthe loop already holds. It now readsanimationComponent.pause; the public API is unchanged.handleErroroverloads formatted the entity name before the logger's level check. The message is built insideLogger.logError's autoclosure.scene.get, sits behind anOSAllocatedUnfairLockinstead of anNSLock.Measured on macOS (Mac16,5, 1920×1080 at 120 Hz, release, three runs each side, aggregated by minimum, before the Gaussian change)
The light scenes move within the run-to-run noise of a mostly idle machine. Most of that gain is the component-id lock, which every ECS access hits.
What the first Apple Vision Pro run said (baseline in #53,
perf/baselines/RealityDevice17_1)Every scene missed the compositor deadline on almost every frame. The light scenes (animation-16, stadium, gaussian) are GPU-bound at 8.6 to 9.7 ms mean GPU time for 14 to 160 visible instances: the fixed per-frame cost of full-screen passes at two eyes of 2048×1984 (Gaussian pass 3.6 to 4.9 ms, G-buffer + light 3.3 to 4.5 ms even with a dozen draws, pre-composite 1.1, output transform 0.8 to 1.9, post-processing bypass 0.4 to 2.0, environment 0.5 to 1.0, HZB and depth copies about 1). The heavy scenes are CPU-bound: 24 ms of encode for 1264 opaque plus 1407 shadow draws (primitives-1k) and 48 ms for the 10k scene, about 9 µs per draw on the headset CPU, with the eye-dependent graph executed twice. Those numbers are the case for the next items in the note: layered stereo with vertex amplification, foveation, the draw list and the scene-access refactor.
Verified
swift build; animation, camera, component-registry and custom-system core tests;GaussianRenderingTest(all but the PSNR comparison, which needscv2locally),GPUPassTimerTests,UpdateXRRenderingSystemTest,WholeRenderGraphValidationTest,EngineStatsMonitorTests; the benchmark runs above.