Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Jan 13, 2026

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 : )

k0kubun and others added 6 commits January 12, 2026 16:55
on `has_commit` check for the `backport` command.

I don't maintain local "master" branch on my ruby repository for stable
branch maintenance. I want just running `git fetch origin` to make it
work. It should work for those who pull origin/master into their local
master too.
Commit 981ee02 ("Fix performance problem with /k/i and /s/i") was
merged for Ruby 4.0 to enable partial Boyer-Moore optimization for
patterns containing 's' or 'k' by using the prefix before those
characters.

However, when 's' or 'k' appears at the start of a pattern (no usable
prefix), set_bm_skip() returns 0 and the code returned early without
setting any optimization mode, leaving reg->optimize at
ONIG_OPTIMIZE_NONE. This caused up to 30x slowdown for patterns like
/slackware/i when matched against strings with non-ASCII characters.

This patch keeps the improvement from 981ee02 for patterns with
3+ char prefix, while fixing the regression by falling back to
ONIG_OPTIMIZE_EXACT_IC with the full pattern when the usable prefix
is less than 3 characters.

Before: /\bslackware\b/i with non-ASCII string: 2.24 us/op
After:  /\bslackware\b/i with non-ASCII string: 0.70 us/op (3.2x faster)

[Bug #21824]
Pretty sure commit 0f64da9 didn't
intend to welcome extension libraries to use these functions.
@pull pull bot locked and limited conversation to collaborators Jan 13, 2026
@pull pull bot added the ⤵️ pull label Jan 13, 2026
@pull pull bot merged commit 60cf859 into turkdevops:master Jan 13, 2026
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.

5 participants