Skip to content

Append duplicate parameter values without copying prior arrays - #10

Closed
OskarEichler wants to merge 2 commits into
faye:mainfrom
OskarEichler:codex/append-duplicate-parameters
Closed

Append duplicate parameter values without copying prior arrays#10
OskarEichler wants to merge 2 commits into
faye:mainfrom
OskarEichler:codex/append-duplicate-parameters

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Append duplicate parameter values to their existing array instead of allocating and copying the accumulated array on every occurrence.

Reproduction and verification

p = WebSocket::Extensions::Parser
p p.parse_header('ext; v=1; v=2; v=3').by_name('ext')
# [{"v"=>[1, 2, 3]}]

1,000 ordered duplicate values verified. In a paired cumulative-parser benchmark, a 1,000-parameter header fell from about 8,013 to 5,017 allocations and 0.961 to 0.594 ms per parse. The exact timings include other verified parser corrections; the isolated source change removes repeated prior-array copies.

  • Ruby 4.0.6 through rbenv; existing current-upstream suite: 64 examples, zero failures on this isolated change.
  • The cumulative release-based candidate passes 283 focused checks (272 baseline failures → zero), 2,784 model checks, the current upstream's 64-example suite, and gem build/extraction.
  • The historical 0.1.5 suite has three Ruby keyword-versus-options-hash mock failures on both baseline and candidate. Current upstream already corrected those expectations; they were run against the candidate through an external preload without changing repository tests.
  • No new or modified tests/specs, following the consumer repository's explicit policy. Reproductions/models were run from external scratch scripts.

Breaking changes and limitations

No intended breaking change. Parameter order, values and single-value representation are unchanged; arrays are owned by this parse, not supplied by callers.

Only local Ruby 4.0.6/macOS execution is claimed; the repository's older Ruby/JRuby matrix needs upstream CI. No production access or unrelated release upgrades.

@OskarEichler

Copy link
Copy Markdown
Author

Understood. These PRs were generated through the dependency audit and the project does not accept agent-authored code without meaningful human authorship and a concrete motivating bug. I cannot honestly provide that context, so I am closing this PR.

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