Commit 74c35f2f authored by Iustin Pop's avatar Iustin Pop
Browse files

Trivial performance optimisation

This is not in the hot-path, but still, no sense in doing O(n) instead
of O(1).
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarRené Nussbaumer <>
parent 6cff91f5
......@@ -1158,7 +1158,7 @@ iterateAlloc :: AllocMethod
iterateAlloc nl il limit newinst allocnodes ixes cstats =
let depth = length ixes
newname = printf "new-%d" depth::String
newidx = length (Container.elems il) + depth
newidx = Container.size il + depth
newi2 = Instance.setIdx (Instance.setName newinst newname) newidx
newlimit = fmap (flip (-) 1) limit
in case tryAlloc nl il newi2 allocnodes of
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment