Skip to content

Resize coverage count arrays in one step#2

Merged
samuel-williams-shopify merged 1 commit into
mainfrom
resize-counts-array-once
Jun 15, 2026
Merged

Resize coverage count arrays in one step#2
samuel-williams-shopify merged 1 commit into
mainfrom
resize-counts-array-once

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

This simplifies the tracer's sparse line-number fallback path by resizing the counts array directly to the required length instead of pushing nil one element at a time. The normal path remains unchanged: preinitialized count arrays should already be large enough for executable lines.

  • Replace repeated rb_ary_push(Qnil) growth with a single rb_ary_resize(..., line + 1) call.
  • Add a sparse high-line-number tracer test to exercise the resize path.

In the bounded-loop benchmark, this was effectively performance-neutral, which is expected because the resize path is rare in normal use.

@samuel-williams-shopify samuel-williams-shopify merged commit 7d71d44 into main Jun 15, 2026
22 of 28 checks passed
@samuel-williams-shopify samuel-williams-shopify deleted the resize-counts-array-once branch June 15, 2026 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant