Quick benchmark in IRB

Posted . Visible to the public.

if you want to see how quick/slow a command is in irb you can paste or mixin the following method:

def time(&block) puts Benchmark.measure(&block) end

then

time { something.that_takes_forever  }

with thanks to: https://makandracards.com/makandra/20541-measure-code-execution-time-in-an-irb-or-rails-console

Rob Williams
Posted by Rob Williams to Foxsoft (2015-11-17 16:49)