diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-04-15 15:18:34 +0200 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-05-04 16:08:55 +0200 |
commit | 955d5affa857ec1f358c56da8fb1ff4ab6590704 (patch) | |
tree | b667ac9f6f62bff17ce032683c0eb09727660555 /modules/openxr | |
parent | 7ebc866418b075df58cbe4e31fcf8b0c3acd70a1 (diff) | |
download | redot-engine-955d5affa857ec1f358c56da8fb1ff4ab6590704.tar.gz |
Reduce and prevent unnecessary random-access to `List`
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)
* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
Diffstat (limited to 'modules/openxr')
-rw-r--r-- | modules/openxr/openxr_api.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index 8731a36865..0742cae26a 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -1335,8 +1335,8 @@ bool OpenXRAPI::on_state_synchronized() { // Just in case, see if we already have active trackers... List<RID> trackers; tracker_owner.get_owned_list(&trackers); - for (int i = 0; i < trackers.size(); i++) { - tracker_check_profile(trackers[i]); + for (const RID &tracker : trackers) { + tracker_check_profile(tracker); } for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) { @@ -1963,8 +1963,8 @@ bool OpenXRAPI::poll_events() { List<RID> trackers; tracker_owner.get_owned_list(&trackers); - for (int i = 0; i < trackers.size(); i++) { - tracker_check_profile(trackers[i], event->session); + for (const RID &tracker : trackers) { + tracker_check_profile(tracker, event->session); } } break; |