diff options
| author | Chris HasiĆski <krzysztof.hasinski@gmail.com> | 2026-01-14 02:41:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-14 14:41:00 +1300 |
| commit | 6e61496531afea45ec53ebfd1a5db12635fc6ed9 (patch) | |
| tree | db37760fd346e2565021452c424e1d10a197f766 /test/ruby/test_string.rb | |
| parent | 65a484578072f86586f250ae28712930da14cf53 (diff) | |
Pre-allocate IO.select result arrays based on input size (#15850)
io.c: pre-allocate IO.select result arrays based on input size
The ternary (rp?rb_ary_new():rb_ary_new2(0)) became pointless after
commit a51f30c671 (Variable Width Allocation, Mar 2022) made both
rb_ary_new() and rb_ary_new2(0) equivalent.
Instead of just removing the dead code, improve on the original intent
by pre-allocating based on the actual input array size. This avoids
reallocations when many FDs are ready.
Benchmark (100 ready FDs): ~8% improvement (5.59 -> 5.11 us/op)
Diffstat (limited to 'test/ruby/test_string.rb')
0 files changed, 0 insertions, 0 deletions
