+25
README.md
+25
README.md
···
···
1
+
# Ruby 4.0 regexp test
2
+
3
+
There seems to be some kind of performance regression in Ruby 4.0 which showed up in my project, which I think is centered around regexp matching. I extracted some minimal code from the project, which runs significantly slower on Ruby 4.0 than on 3.4.
4
+
5
+
Running on my server, with 1000 loops:
6
+
7
+
```
8
+
$ asdf shell ruby 3.4.8
9
+
$ ruby test.rb 1000
10
+
1000 * 940 = 940000 records in 7.439838799 -> 126346.82355299778 records/s
11
+
$ asdf shell ruby 4.0.0
12
+
$ ruby test.rb 1000
13
+
1000 * 940 = 940000 records in 13.67647823 -> 68731.14439198723 records/s
14
+
```
15
+
16
+
With YJIT:
17
+
18
+
```
19
+
$ asdf shell ruby 3.4.8
20
+
$ RUBYOPT="--enable-yjit" ruby test.rb 1000
21
+
1000 * 940 = 940000 records in 7.20592409 -> 130448.22402507435 records/s
22
+
$ asdf shell ruby 4.0.0
23
+
$ RUBYOPT="--enable-yjit" ruby test.rb 1000
24
+
1000 * 940 = 940000 records in 13.457106019 -> 69851.57125706079 records/s
25
+
```