Closed cristicbz closed 7 years ago
cc @mbrubeck what do you think?
@TeXitoi when you get a chance, could you please update your submission with this? I think Isaac is losing his patience a little bit with us (maybe justifiably so :) ).
Looks good to me.
So I actually changed the implementation to match the one in Haskell more closely and submitted it at: https://alioth.debian.org/tracker/index.php?func=detail&aid=315639&group_id=100815&atid=413122
Unless Isaac changes his mind, it sounds like Rust will not be allowed to use tail recursion at all and we'll need to revert back to the plain recursive item_check.
I created another submission with a vanilla recursive item_check
.
I'll make a PR if Issac decides it's OK
Rewrite
item_check
as an explicit loop rather than tail recursive calls, making the implementation much shorter with the same performance characteristic.Also flips the allocation order of left and right children to match the traversal order of the new method (which does the right branch depth-first on every iteration).
This doesn't affect performance at all on my machine, and Isaac didn't like the previous implementation.