RubyGems Hackfest Weekend 1 Complete!

| | Comments (3)

We started our RubyGems Hackfest Saturday, with a turnout of 6 people. Five were regulars from Seattle.rb, and we even got someone up from Portland! We started Saturday by brainstorming things we'd like, writing up story cards, estimating and risking them. Then we paired up and got testing!

By the end of day 1, we'd finished cards 1-3 and gotten pretty good testing infrastructure in place for stuff we needed. I spent some extra time making it so that all unit tests generate their gems on the fly, weren't dependent on the location from which they were run, and didn't use or create any files in the test directory. We went over our estimates by 3.5 hours. Much of that was my fault, it was too hot for me to think.

On day 2, we were down to 4 people, but had much better testing capabilities. Aaron and Evan finished up the package listing command extension and gave .gemrc the ability to have .cvsrc-style command option specifications. Eric and I worked on the hardest bug we had, which was to get rid of the use of Date. We succeeded on both counts! We went over by 1 hour on a task, and under by 1 hour on the other. YAY! I've been wanting to conquer this issue for quite some time!

Below you can see a the fruits of our labors:

Old and Bad:

% time ruby -rprofile -rrubygems -e 'require_gem "RubyInline"' 2>&1 |head
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 19.79     0.95      0.95      132     7.20    10.38  Integer#gcd
  8.96     1.38      0.43      572     0.75     1.47  Gem::Specification#copy_of
  6.46     1.69      0.31       68     4.56   100.88  Array#each
  5.21     1.94      0.25     3315     0.08     0.08  Fixnum#==
  3.96     2.13      0.19      220     0.86     1.23  Rational#initialize
  3.54     2.30      0.17     1628     0.10     0.16  Kernel.===
  3.12     2.45      0.15      132     1.14    13.48  Rational#reduce
  2.71     2.58      0.13      463     0.28     0.37  Kernel.dup

real	0m5.530s
user	0m4.856s
sys	0m0.323s

New and Good:

% time ruby -Ilib -rprofile -rrubygems -e 'require_gem "RubyInline"' 2>&1 |head
  %   cumulative   self              self     total
 time   seconds   seconds    calls  ms/call  ms/call  name
 24.63     0.50      0.50      572     0.87     1.50  Gem::Specification#copy_of
  8.87     0.68      0.18       37     4.86    82.43  Array#each
  7.39     0.83      0.15       44     3.41     4.32  Date#_parse
  6.90     0.97      0.14     1628     0.09     0.14  Kernel.===
  4.43     1.06      0.09     1386     0.06     0.06  Kernel.==
  4.43     1.15      0.09     1211     0.07     0.07  Module#===
  3.94     1.23      0.08        5    16.00    22.00  Hash#each
  3.94     1.31      0.08       20     4.00    29.00  Kernel.require

real	0m2.415s
user	0m2.070s
sys	0m0.183s

3 Comments

sorry: did'nt you get rid of Date? then why there is Date#_parse in the latter profile trace?

We got rid of Date and switched it to Time, yes. What time does under the covers we don't care as long as it is faster and passes all its tests.

It turns out that Time.parse calls ParseDate.parse which calls Date._parse (which isn't in date.rb, but is in date/format.rb). It looks like _parse does all the work, but without creating a Date instance and so avoids the heavy cost of Rational#gcd.

I still think you should simply have reimplemented Rational#gcd. :)

Leave a comment