QML: Various easy optimizations#12968
Merged
DonLakeFlyer merged 2 commits intomavlink:masterfrom Jun 7, 2025
Merged
Conversation
Replaced manual QML loading and object lifetime management with Loaders. This substantially improves performance, as Loader is optimized for dynamic component loading, and avoids JavaScript on the object construction. It's also a more canonical and therefore maintainable approach. Key changes: - Removed manual lifecycle and error handling code for component creation. - Introduced Loaders to dynamically load map visuals asynchronously. - Set properties and reconnected signal bindings via Loader.setSource and Loader.onLoaded, respectively, avoiding slow JavaScript logic.
Set the asynchronous property of the mission item editor's Loader to true, to prevent blocking the main GUI thread when expanding mission items.
Contributor
Author
|
There's many more QML components which should be refactored to use a Loader instead of manual loading with JS, including most map visual items, but here I focused on the SimpleItemMapVisual which is by far the most common one to have multiple of. The asynchronous property of Loaders should also be used more often in the codebase IMO. |
DonLakeFlyer
reviewed
Jun 7, 2025
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.
QML: Various easy optimizations
Description
Replaced manual QML loading and object lifetime management in SimpleItemMapVisual and MissionItemMapVisual with Loaders. This substantially improves performance, as Loader is optimized for dynamic component loading, and avoids JavaScript on the object construction. It's also a more canonical and therefore maintainable approach.
Set the asynchronous property of MissionItemEditor's Loader to true, to prevent blocking the main GUI thread when expanding mission items.
Key changes:
Profiling results (before)
Profiling results (after)
Note the lack of entries for SimpleItemMapVisual, MissionItemMapVisual or MissionItemEditor. The profiling tests were performed manually (following the exact same actions each time), which is the reason for the differences in total time.
Checklist:
Related Issue
#12236
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.