You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The property path_name references sep, but the property sep is itself recursive, so it takes k^2 lookups but only k lookups are needed. Furthermore, it does string addition in a (recursive) loop, but there are better ways to construct strings.
Perhaps change this to:
self.sep.join(reversed(self.ancestors))
or probably even faster:
ancestors = list(self.ancestors)
sep = ancestors[-1]._sep # No recursion because sep is taken directly from root
return sep.join(reversed(ancestors)
The text was updated successfully, but these errors were encountered:
lverweijen
changed the title
Property path_name can be made more effecient
Property path_name can be made more efficient
Jul 10, 2023
See
bigtree/bigtree/node/node.py
Line 119 in a507fa7
The property
path_name
referencessep
, but the propertysep
is itself recursive, so it takesk^2
lookups but onlyk
lookups are needed. Furthermore, it does string addition in a (recursive) loop, but there are better ways to construct strings.Perhaps change this to:
or probably even faster:
The text was updated successfully, but these errors were encountered: