rails/rails — pull request #12408 by carlosparamio (2013-09-30 08:25:41+00:00)
Title: Remove block argument when not used on the method body to avoid performance penalties with its conversion to a proc

With this closed pull request:

https://github.com/rails/rails/pull/12353

I learned that using &block as an explicit argument to a method is slow. It seems to be related to the conversion of the block to a proc object on every call. I did some benchmarks with different ruby interpreters, one of them using a mandatory proc object as an argument to use it with "call" instead of "yield", and the results point out that the conversion can make the method invocation up to x4 slower consistently on the different ruby interpreters:

https://gist.github.com/carlosparamio/6760567

So took the opportunity to take a look at the different Rails gems, and removed all the cases I found that still were declaring the block as an argument, to scratch those few milliseconds on their invocations.