You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-20 14:45:44 +00:00
Optimize initial Node::get_path call by avoiding Vector::reverse
This commit is contained in:
@@ -2396,14 +2396,14 @@ NodePath Node::get_path() const {
|
||||
const Node *n = this;
|
||||
|
||||
Vector<StringName> path;
|
||||
path.resize(data.depth);
|
||||
|
||||
StringName *ptrw = path.ptrw();
|
||||
while (n) {
|
||||
path.push_back(n->get_name());
|
||||
ptrw[n->data.depth - 1] = n->get_name();
|
||||
n = n->data.parent;
|
||||
}
|
||||
|
||||
path.reverse();
|
||||
|
||||
data.path_cache = memnew(NodePath(path, true));
|
||||
|
||||
return *data.path_cache;
|
||||
|
||||
Reference in New Issue
Block a user