micro-optimization

This commit is contained in:
Kovid Goyal 2021-05-18 20:27:46 +05:30
parent a0c5990dde
commit 11253571c4
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -77,9 +77,9 @@ class ToCOffsetMap:
while parent?:
ancestors.push(parent)
parent = self.parent_map[parent.id]
if len(ancestors) > 1:
ancestors.pop() # root node
for v'var i = ancestors.length; i-- > 0;':
if ancestors.length > 1:
# last item in ancestors is the root node
for v'var i = ancestors.length - 1; i-- > 0;':
ans.push(ancestors[i].id)
ans.push(node.id)
return ans