You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, each segment has the following structure:
classSegment{coincidents=[this, ...]// list of segments that *exactly* overlap this segment, including itselfringIn=<ring> // the input ring this segment came from
flowL2R = <boolean> // the direction, clockwise or counter-clockwise, this segment faced in its input ring
...
}
This is somewhat wasteful because nearly all input segments have only one coincident - themselves. So Segment.coincidents is nearly always just a one-element array. So one possible performance improvement would be to leave Segment.coincidents undefined until at least one coincident segment is identified, and at that point initialize it to an array of two segments: [this, otherSeg].
Even better would be:
First, by addressing #30, hopefully the need to carry around the boolean flowL2R goes away.
Then the following structure would be possible:
classSegment{ringsIn=[<ring>, ...] // list of input rings this segment represents
...
}
This drops the coincidents array altogether. Essentially when two segments realize they're coincident, instead of just marking themselves as such, one would 'die' and give its input ringIn to the surviving segment. The dieing segment could either be marked 'dead' with a tombstone or it could be proactively removed from the datastructures (the sorted tree of segments and the sweep event priority queue).
And from here, since 99% of input segments only represent one ring, we could employe the the following more complicated, but likely more performant structure:
classSegment{ringIn=<ring> // only defined when the segment represents just one ring
ringsIn = [<ring1>, <ring2>, ... ] // only defined when the segment represents two or more rings
...
}
The text was updated successfully, but these errors were encountered:
Breaking up the segment.ringsIn array into two parts (segment.ringIn and segment.ringsIn) did not end up yielding noticeable performance gains in the benchmark, and complicated the code appreciably, as such that was not implemented.
However, the segment.coincidents array has been dropped as suggested in this ticket and replaced with the simpler and more performant segment.ringsIn array.
Right now, each segment has the following structure:
This is somewhat wasteful because nearly all input segments have only one coincident - themselves. So
Segment.coincidents
is nearly always just a one-element array. So one possible performance improvement would be to leaveSegment.coincidents
undefined until at least one coincident segment is identified, and at that point initialize it to an array of two segments:[this, otherSeg]
.Even better would be:
First, by addressing #30, hopefully the need to carry around the boolean
flowL2R
goes away.Then the following structure would be possible:
This drops the
coincidents
array altogether. Essentially when two segments realize they're coincident, instead of just marking themselves as such, one would 'die' and give its inputringIn
to the surviving segment. The dieing segment could either be marked 'dead' with a tombstone or it could be proactively removed from the datastructures (the sorted tree of segments and the sweep event priority queue).And from here, since 99% of input segments only represent one ring, we could employe the the following more complicated, but likely more performant structure:
The text was updated successfully, but these errors were encountered: