Reproduce and suggest fix for desktop app move performance issues#9113
Draft
ben-polinsky wants to merge 1 commit into
Draft
Reproduce and suggest fix for desktop app move performance issues#9113ben-polinsky wants to merge 1 commit into
ben-polinsky wants to merge 1 commit into
Conversation
Contributor
|
If your decorations are not changing every dynamics frame, are you creating them as cached decorations? If all the decorations are cached, how is the performance? |
Contributor
People probably are relying on this even if they aren't aware...otherwise a lot of "tools" with decorations that follow the cursor would likely need to start explicitly invaliding decorations onMotion... |
Contributor
Author
In the reproduction, it's very good. |
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.
This PR proposes two fixes to improve viewer rendering performance related to moving elements, surfaced in a desktop application. User noted performance was not great in 4.11 while moving elements, but that iTwin.js 5.2 exacerbated the issue.
Decouple dynamics and decoration invalidations
We believe the
invalidateDecorations()call inside ofViewport.changeDynamics()is the root cause of these performance issues. This forces a full decoration rebuild on every mouse move during dynamics.While dynamics and decorations are related concepts, and I'm ignorant of much of the history here, it seems like they are rendered separately. Maybe it's idealistic (or ignorant), I don't think the two should invalidate each others' calls.
Assuming the idea behind this fix is on the right track, the next question is "are our consumers relying on this behavior"? In discussions with Mark and Erin, we don't think we can guarantee they are not. Thus, if we move forward, should probably make this behavior opt-in.
Issue exacerbated by #7604
A change in the above PR corresponds to our user's complaint that the performance became extremely noticeable in 5.2. Looking here,
screenViewport.addDecorations()iteratesgetTileTreeRefs(), which yields view model refs + displayStyle refs + map refs + tiled graphics provider refs. Butthis.viewis already decorated on the line above, so the view/displayStyle refs are seemingly redundant?I've added a DTA reproduction with instructions in
display-test-app/src/frontend/ReproIssue1659.ts. DTA repro tool - adds decorators matching the desktop app's patterns (uncached connector decorators, cached annotation overlays), then you use the real dta interactive move tool. dta repro 1659 toggle flips the actual code paths between fixed and regressed behavior so you can compare live. The first issue above seems to be the cause of most of the performance issues, but it is dependent on the complexity of the setup (num of models/elements/decorators).@markschlosseratbentley @eringram have been involved in discussions.
@bbastings We're eager to know your thoughts when you have a chance.