Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Dec 3, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

kddnewton and others added 8 commits December 2, 2025 22:14
(ruby/strscan#180)

Since `[](n)` is being interpreted as a Markdown link, it cannot be
displayed as a method call.
I have corrected this by escaping the brackets so that they are
interpreted as strings rather than links.

### Before

ri

```
    #{}[n]     |   <tt>n</tt>th captured substring.    |       +nil+.
```

html

<img width="424" height="217" alt="image"
src="https://github.com/user-attachments/assets/b45601ab-ed1c-4b82-b112-325f12bde197"
/>

### After

ri

```
    #[](n)     |   <tt>n</tt>th captured substring.    |       +nil+.
```

html

<img width="489" height="217" alt="image"
src="https://github.com/user-attachments/assets/1212c147-42a5-4f62-8667-a279ccff67a3"
/>

ruby/strscan@b3d56867fd
When all elements are strings, we never have to recalculate the length
of the array because there are no conversion methods that are called, so
the length will never change. This speeds up the fast path by ~10%.

```ruby
a = ["1"*10, "2"*10, "3"*10, "4"*10, "5"*10] * 10
10_000_000.times do
  a.join
end
```

```
hyperfine --warmup 1 'ruby ../ruby2/test.rb' './exe/ruby ../ruby2/test.rb'
Benchmark 1: ruby ../ruby2/test.rb
  Time (mean ± σ):      3.779 s ±  0.053 s    [User: 3.754 s, System: 0.017 s]
  Range (min … max):    3.715 s …  3.874 s    10 runs

Benchmark 2: ./exe/ruby ../ruby2/test.rb
  Time (mean ± σ):      3.411 s ±  0.038 s    [User: 3.387 s, System: 0.017 s]
  Range (min … max):    3.360 s …  3.472 s    10 runs

Summary
  ./exe/ruby ../ruby2/test.rb ran
    1.11 ± 0.02 times faster than ruby ../ruby2/test.rb
```
@pull pull bot locked and limited conversation to collaborators Dec 3, 2025
@pull pull bot added the ⤵️ pull label Dec 3, 2025
@pull pull bot merged commit a211abb into turkdevops:master Dec 3, 2025
1 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants