We use RubyUnit for XP-style unit testing as well as
acceptance testing. (We haven't been able to fit in
a Test::Unit spike yet.) 

Some of our acceptance test suites contain some (naive?)
performance tests like

 def testPerformance
  startTime = Time.times.utime
   Case.new(@caseData).run
  elapsedTime = Time.times.utime - startTime
  assert_equal_float(45, elapsedTime, 2, "seconds")
 end

The strange thing is that running the same case outside
of RubyUnit runs in about half the time(!), and merely
inserting a new chunk of (unused!!) code in the acceptance
test suite can change the timing results of the performance
test by 10 to 20 percent!

What's going on?  Are we seeing a garbage collection effect?

Is there a better way to measure performance in this context?

TIA,
-- 
Bil Kleb
NASA Langley Research Center
Hampton, Virginia, USA