Benchmarking whole programs

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 ?