summaryrefslogtreecommitdiffstats
path: root/core/doc_data.cpp
diff options
context:
space:
mode:
authorA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-04-15 15:18:34 +0200
committerA Thousand Ships <96648715+AThousandShips@users.noreply.github.com>2024-05-04 16:08:55 +0200
commit955d5affa857ec1f358c56da8fb1ff4ab6590704 (patch)
treeb667ac9f6f62bff17ce032683c0eb09727660555 /core/doc_data.cpp
parent7ebc866418b075df58cbe4e31fcf8b0c3acd70a1 (diff)
downloadredot-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 'core/doc_data.cpp')
-rw-r--r--core/doc_data.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/doc_data.cpp b/core/doc_data.cpp
index 7549ba884e..672a36c35c 100644
--- a/core/doc_data.cpp
+++ b/core/doc_data.cpp
@@ -152,9 +152,10 @@ void DocData::method_doc_from_methodinfo(DocData::MethodDoc &p_method, const Met
return_doc_from_retinfo(p_method, p_methodinfo.return_val);
- for (int i = 0; i < p_methodinfo.arguments.size(); i++) {
+ int i = 0;
+ for (List<PropertyInfo>::ConstIterator itr = p_methodinfo.arguments.begin(); itr != p_methodinfo.arguments.end(); ++itr, ++i) {
DocData::ArgumentDoc argument;
- argument_doc_from_arginfo(argument, p_methodinfo.arguments[i]);
+ argument_doc_from_arginfo(argument, *itr);
int default_arg_index = i - (p_methodinfo.arguments.size() - p_methodinfo.default_arguments.size());
if (default_arg_index >= 0) {
Variant default_arg = p_methodinfo.default_arguments[default_arg_index];