capsule.GenerateIndexList copies most of its cylinder's index list (GetRange is a shallow copy) to trim off the end rings that need to belong to the hemisphere endcaps instead. A Slice type, which is an offset view of a backing list, preserves the existing code without copying the list.
I believe the existing call into this function would cause the list being unnecessarily mostly copied to be about 65,000 elements long. Unnecessary copies are fine (and often optimal, for languages that aren't designed around slicing) for small lists but a bad idea for large ones, and the "small" threshhold is somewhere below a thousand.
capsule.GenerateIndexList copies most of its cylinder's index list (GetRange is a shallow copy) to trim off the end rings that need to belong to the hemisphere endcaps instead. A Slice type, which is an offset view of a backing list, preserves the existing code without copying the list.
I believe the existing call into this function would cause the list being unnecessarily mostly copied to be about 65,000 elements long. Unnecessary copies are fine (and often optimal, for languages that aren't designed around slicing) for small lists but a bad idea for large ones, and the "small" threshhold is somewhere below a thousand.