Skip to content

Make currentPath a slice

Luke Champine requested to merge stateslice into master

This turned out to be simpler than expected, mostly because the syntax for map access and slice access is the same. The only trouble I had was with s.height(); originally I had it return len(s.currentPath), which is 1 too big.

Just comparing test times, the speed-up seems pretty minimal, though I'd be interested in running a real benchmark. This is less of an efficiency thing and more of a simplicity thing anyway, though.

This made it easy to write BlockRange, which is now used in Synchronize. The semantics are a little weird because of the +1 thing. Maybe height should return len(s.currentPath) after all? Anyway, this is nice because Synchronize is now guaranteed to draw from currentPath.

Merge request reports