[Rubygems-developers] Gem::Specification#copy_of and Rails makes tests startup slow

Eric Hodel drbrain at segment7.net
Thu Dec 2 01:13:37 EST 2004

I have a small testcase in rails that has 7 tests in it (4 of them 
raise NotImplementedError), but simply starting up the testcase takes 3 

$ ruby -r profile -Ilib:test test/unit/emailer_test.rb
   %   cumulative   self              self     total
  time   seconds   seconds    calls  ms/call  ms/call  name
  18.37     5.57      5.57      462    12.06    19.42  Integer#gcd
  10.26     8.68      3.11     4008     0.78     2.37  

The tests themselves complete in less time than it takes to perform all 
the copying:

$ ruby -Ilib:test test/unit/emailer_test.rb | unit_diff
Loaded suite test/unit/emailer_test
Finished in 2.526909 seconds.
7 tests, 18 assertions, 0 failures, 4 errors

When running the entire test suite this startup cost is minimal 
compared to the run time of the tests, but it rarely makes sense to run 
the entire test suite at once.  Is all the copying done in #copy_of 
completely necessary?

BTW: These were run on a PowerBook G4 1.5GHz

More information about the Rubygems-developers mailing list