Use if block instead of if block_given? when block is explicit
It's more simple and also here is a benchmark https://gist.github.com/1354411
change block given condition in methods with explicit block
@rkh Could you give some comments? I really think it's reasonable change and it does some performance burst.
To be honest, I think this pull request is a bit ridiculous. The only place where this brings "performance" is in the body helper (all other methods are only called at load time). The impact of defining a method on that proc is so expensive though, that the "boost" becomes irrelevant. On implementations that support inlining (any common implementation but MRI), block_given? is faster, as it will become a single inlined assertion rather than a slot lookup.
Running an app using body with a block does not show any difference in terms of req/sec with or without this pull request on ant Ruby implementation (tried 1.8.7, 1.9.2, 1.9.3, Rubininus 2.0 and JRuby 1.6.5).
Please provide relevant benchmarks (i.e. how this influences Sinatra performance, no micro benchmarks).