Skip to content

[pull] master from ruby:master#847

Merged
pull[bot] merged 7 commits intoturkdevops:masterfrom
ruby:master
Mar 13, 2026
Merged

[pull] master from ruby:master#847
pull[bot] merged 7 commits intoturkdevops:masterfrom
ruby:master

Conversation

@pull
Copy link

@pull pull bot commented Mar 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 : )

kddnewton and others added 7 commits March 13, 2026 09:15
Apple's libc implementation of memmem is super slow (it is a forked
version of freebsd's that never got vectorized). Instead, we should
fall back to the rolling hash on Apple. In the attached benchmark,
I'm seeing 1.07% slower to 30.34% slower, depending on the
haystack.

For reference, here are the various implementations I checked:

* musl: https://git.musl-libc.org/cgit/musl/tree/src/string/memmem.c
* freebsd: https://github.com/freebsd/freebsd-src/blob/main/lib/libc/string/memmem.c
* apple: https://github.com/apple-oss-distributions/Libc/blob/main/string/FreeBSD/memmem.c

You can see Apple just linearly searches through the string and
calls memcmp each time, whereas the other two do a window'd rolling
hash similar to the fallback Ruby already has.
Prevent GC from accidentally collecting
This test should be redesigned, but increasing the timeout
should probably be good enough for now to not see CI failures related
to it. I can see how this could timeout after 10s.

Failing test after 10s timeout:
https://ci.rvm.jp/results/trunk_gcc10@ruby-sp2-noble-docker/6247393

According to the stack trace at time of abort, there was no deadlock and
it was in the middle of a GC. Everything looks fine. This is assuming
the fatal signal came from `EnvUtil.terminate`.
….java

* TRUFFLERUBY_METRICS_REPS=5 jt metrics time --experimental-options -e0
  For parsing-core:
  before: 0.097 0.099 0.092 0.096
  after:  0.061 0.063 0.066 0.059
* Remove extra trailing spaces by using `<%-#`.

ruby/prism@e08b47e26c
@pull pull bot locked and limited conversation to collaborators Mar 13, 2026
@pull pull bot added the ⤵️ pull label Mar 13, 2026
@pull pull bot merged commit ee275b4 into turkdevops:master Mar 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.

3 participants