[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Benchmarking whole programs

gabriele renzi

4/5/2005 4:29:00 PM

Hi gurus and nubys,

I was playing with the ruby programs in the alioth language shootout
and I realized I have no idea on how to benchmark them all.
What I mean is: If I want to benchmark a single function I can use the
usual benchmark code also shown in ri, but what if I want to check two
slightly different implementations of a a single program?

I can't just stick them all in a #meth1 and #meth2 thing, since there
may be constants defined (actually they almost surely will, at least
classes and modules), I suppose I could do something like:
Benchmark.bm do |x|
x.report {require 'first_impl'; main()}
x.report {require 'second_impl'; main()}
end

but this seems kludgy and loading the thing at each run could mess up
the results, I think.
Some suggestions, apart from using the time unix utility ?