Perf: Prevent pipeline from aging scene after timeline finishes - #61
Merged
Merged
Conversation
Added - State caching mechanism to RenderStateAssembler and ExtensionStatisticsAssembler - Snapshot caching to RenderEventBuffer for unchanged scene states Changed - SceneFrameUpdater now properly freezes delta time for `Finished` state, matching `Idle` and `Paused` - Re-enabled rendering cache logic to utilize identical snapshots instead of full rebuilds Result Cache hits now properly resolve during idle and finished playback states. Rendering interaction benchmarks (100000 events) demonstrate significant improvements: - SweepHoverAndRenderFrames: 726.256 ms -> 64.122 ms - PanZoomAndRenderFrames: 758.712 ms -> 44.596 ms - ToggleLayoutAndRenderFrames: 763.527 ms -> 59.904 ms Allocations per frame dropped drastically from ~179.5 MB to ~14 KB.
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.
Summary
Stop continuous scene aging and cache invalidation when the playback reaches the
Finishedstate. This prevents full snapshot rebuilds on every frame when the visual state is static, delivering massive performance and allocation improvements.Added
RenderStateAssemblerandExtensionStatisticsAssemblerto bypass snapshot rebuilds when visual state remains unchangedRenderEventBufferto reuse identical scene states efficientlyChanged
SceneFrameUpdaternow correctly freezes delta time (dt) for theFinishedplayback state, matching existing behavior forIdleandPausedFixed
wall timeafter the timeline had already completed, which kept invalidating the cache unnecessarilyResult
Cache hits now properly resolve during idle and finished playback states. Rendering interaction benchmarks demonstrate a massive speedup and drastically reduced per-frame allocations.
At
100000events:SweepHoverAndRenderFrames:726.256 ms->64.122 msPanZoomAndRenderFrames:758.712 ms->44.596 msToggleLayoutAndRenderFrames:763.527 ms->59.904 msSweep):179.5 MB->14.34 KBPanZoom):179.5 MB->13.88 KBToggle):179.5 MB->13.88 KBAt
10000events:Sweep:40.643 ms->1.753 msPanZoom:42.000 ms->1.414 msToggle:41.236 ms->1.619 msTesting
[✓]
dotnet test Tests/ChangeTrace.Tests.csproj --filter "FullyQualifiedName~ChangeTrace.Tests.Rendering.States"[✓]
dotnet run -c Release --project Benchmarks/ChangeTrace.Benchmarks.csproj -- --filter "*RenderingInteractionWorkflowBenchmarks*"Linked Issues
Checklist
[✓] PR is focused and does not include unrelated cleanup
[✓] Public API changes are documented
[✓] Breaking changes are explicitly described
[✓] New behavior follows existing project architecture
[✓] I followed the Code of Conduct /CODE_OF_CONDUCT.md