1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

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
This commit is contained in:
A Thousand Ships
2024-04-15 15:18:34 +02:00
parent 7ebc866418
commit 955d5affa8
103 changed files with 877 additions and 849 deletions

View File

@@ -188,11 +188,11 @@ static void recursively_disassemble_functions(const Ref<GDScript> script, const
const MethodInfo &mi = func->get_method_info();
String signature = "Disassembling " + mi.name + "(";
for (int i = 0; i < mi.arguments.size(); i++) {
if (i > 0) {
for (List<PropertyInfo>::ConstIterator arg_itr = mi.arguments.begin(); arg_itr != mi.arguments.end(); ++arg_itr) {
if (arg_itr != mi.arguments.begin()) {
signature += ", ";
}
signature += mi.arguments[i].name;
signature += arg_itr->name;
}
print_line(signature + ")");
#ifdef TOOLS_ENABLED