Write your alternative implementation next to the original one, with a _perf suffix on the name. Benchmark.swap runs your block twice, once with the original methods and once with the suffixed twins in their place, and compares the two. No need to lift the method out of its call chain first.
Required Ruby Version
>= 3.2
Authors
Mehmet Emin INAC