You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Followup: rails#54504
Followup: rails#54491
The existing inheritence based visitor cause a lot of extra
method calls and rely on `send` a lot, defeating method caches.
Since that visitor in particular is part of the hot path of finding
a route for the incomming request, it's worth optimizing it specifically.
And in the end, I could argue it's much easier to grok than the previous
implementation.
Same benchmark as: rails#54491 (comment)
```
== index ==
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
after 40.563k i/100ms
Calculating -------------------------------------
after 405.756k (± 2.5%) i/s (2.46 μs/i) - 2.028M in 5.001706s
Comparison:
before: 361017.1 i/s
after: 405756.2 i/s - 1.12x faster
== show ==
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
after 31.235k i/100ms
Calculating -------------------------------------
after 316.240k (± 1.2%) i/s (3.16 μs/i) - 1.593M in 5.038025s
Comparison:
before: 274268.3 i/s
after: 316240.2 i/s - 1.15x faster
== show_nested ==
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +YJIT +PRISM [arm64-darwin23]
Warming up --------------------------------------
after 29.238k i/100ms
Calculating -------------------------------------
after 286.828k (± 1.4%) i/s (3.49 μs/i) - 1.462M in 5.097862s
Comparison:
before: 246428.3 i/s
after: 286828.0 i/s - 1.16x faster
```
0 commit comments