Repository navigation
Performance: reduce UI stalls while dragging layers - #807
Merged
h-a-n-a-s-h-i merged 1 commit intoOct 12, 2026
Merged
Conversation
Member
|
Merged. Thank you for the contribution, @cdinhoo! If you haven't already, come join us on Discord: https://discord.gg/artcraft. It's the best place to discuss what you're working on next and to coordinate with other contributors. |
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.
Dragging layers can stall the UI in expression-heavy compositions: the red selection/bounding box and its handles lag behind the mouse, and playhead movement and visibility toggles can also feel delayed. This happens even when no expression warning is visible and reducing preview resolution does not help. Three UI paths contributed to the reported case: duplicate synchronous expression diagnostics (including non-solo layers), repeated evaluation of HUD geometry during snapping, and disk-cache content hashing while painting the timeline.
Verified drag-overlay behavior: in the native macOS test build, the reporter confirmed that the red selection box follows the cursor promptly with Snapping off, while the rendered composition image may trail until a frame finishes. The native fix moves automatic expression diagnostics and timeline content hashing off the UI thread, allowing selection controls to update while preview rendering continues. Automated coverage drags a selected layer and checks that its selection bounds move while a diagnostic expression remains blocked on a worker. Remaining limit: Snapping on still adds noticeable latency in this expression-heavy reproduction; this PR reduces that cost but does not eliminate it or claim every handle/tool interaction is latency-free.
This change:
Diagnostics still include non-solo layers and disabled syntax errors. The explicit
expr.errorscommand keeps its synchronous behavior. On the single-threaded browser build, diagnostics share the cache and debounce but still scan after interaction stops; disk hashing there remains synchronous. Snapping reuse applies across platforms.Validation:
RUST_TEST_THREADS=1 cargo xtask cipassed on macOS: formatting, Clippy with warnings denied, 2,835 tests passed (26 ignored), dependency layering, asset attribution, and the 32-crate WASM check. The initial parallel run failed two unchanged font-fallback tests on this Mac; all 48 text tests and the complete gate passed with test cases serialized. WASM reports the existing unusedpointer_wrap::State.disabledfield warning.Measured on the reporter’s all-visible 29-layer project copy with actual pointer drag events (20 move events, headless egui layout/paint/tessellation; excludes GPU presentation):
The remaining limits are expensive snapping geometry and expression-heavy preview rendering. In this reproduction, evaluating the remaining distinct snap-target expressions still costs about 34 ms per query. The diagnostics-only baseline already includes the asynchronous diagnostics fix.
Related work: #784 (obsolete video-decode cancellation) and #793 (preview-cache scheduling; builds on #784) touch shared frame/viewer code. They address separate causes of lag and are not dependencies of this PR; test the changes together when integrating.