File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
src/main/java/org/truffleruby/core/rope Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -314,7 +314,9 @@ public static byte[] flattenBytes(Rope rope) {
314
314
// need to track each SubstringRope's bounded length and how much that bounded length contributes to the total
315
315
// byte[] for any ancestor (e.g., a SubstringRope of a ConcatRope with SubstringRopes for each of its children).
316
316
// Because we need to track multiple levels, we can't use a single updated int.
317
- final BoundedIntStack substringLengths = new BoundedIntStack (rope .depth ());
317
+ // SubstringRope.child is never a SubstringRope, so there are most depth / 2 SubstringRope.
318
+ // TODO (eregon, 9 July 2020): maybe we should resize dynamically to avoid a too big array if the depth option is large?
319
+ final BoundedIntStack substringLengths = new BoundedIntStack (rope .depth () / 2 );
318
320
319
321
final Deque <Rope > workStack = new ArrayDeque <>();
320
322
workStack .push (rope );
You can’t perform that action at this time.
0 commit comments