I could not resolve in my mind exactly what you meant in your example code
snippet, but here's a patch that I believe accomplishes the same thing. It's
merely a renaming of the variable, and using the 'mergeSegement decrements'
concept that you mention which I think is a good idea.
This patch still doesn't speed up the actual detecting of what segments on the
stack to merge when it does go into that loop. I need to re-baseline the
performance measurements with this patch to see where the CPU is now spending
most of it's time, as it it may now be somewhere else entirely.
NOTE: all current unit tests still pass with this patch.