Module | Ramaze::Helper::Bench |
In: |
lib/ramaze/helper/bench.rb
|
Little helper to give you a hand when benching parts of actions
Will first run an empty loop to determine the overhead it imposes, then goes on to yield your block iterations times.
The last yielded return value will be returned upon completion of the benchmark and the result of the benchmark itself will be sent to Log.info
Example:
class MainController < Ramaze::Controller def index @users = bench{ User.all } @tags = bench{ Article.tags } end end
This will show something like following in your log:
So now we know that the Article.tags call takes the most time and should be improved.