Re: run flags vs active intervals
Christopher <cku...@...>
I like this idea too. What we were discussing yesterday was something
toggle quoted message
Show quoted text
like: index: [ 0 1 2 3 4 5 6 7 8 9 ] flags: [ 0 0 1 1 1 1 0 0 1 0 ] active_points: [ 2 3 4 5 8 ] for (int i = 0; i < num_active; i++) do_something(active_points[i]); This would be slightly more efficient if you had a single point active (or isolated single points), but it requires a lot more indirections in the common case. So I'm all in favor of trying this out - though it is a pretty big overhaul ... I would maintain these ranges as little int arrays on the stack just like we maintain the runflags now. The upper bound for the active_range array size is just npoints (run flags: on off on off on off ...) - flip any bit and you get fewer "runs". -Chris On Jan 21, 9:16 am, Larry Gritz <l...@...> wrote:
Awesome, Chris. Would you believe we were just talking internally about this topic yesterday? We were considering the amount of waste if there were big gaps of "off" points in the middle. But I think your solution is quite a bit more elegant than what we were discussing (a list of "on" points). I like how it devolves into (begin,end] for the common case of all points on. |
|