[Rails] Integer#gcd makes tests go slow
David Heinemeier Hansson
david at loudthinking.com
Thu Dec 2 10:43:21 GMT 2004
> Will switching to YAML fixtures make this faster?
It doesn't seem like it. I just ran this test:
1000.times do YAML::load "date: 2005-12-12" end
Envy:~ david$ ruby -r yaml -r profile test.rb
% cumulative self self total
time seconds seconds calls ms/call ms/call name
33.28 18.69 18.69 3000 6.23 9.12 Integer#gcd
6.82 22.52 3.83 71000 0.05 0.05 Fixnum#==
6.11 25.95 3.43 3000 1.14 11.69 Rational#reduce
5.77 29.19 3.24 1000 3.24 5.59 Date#jd_to_civil
5.04 32.02 2.83 5000 0.57 0.74
Rational#initialize
4.31 34.44 2.42 45000 0.05 0.05 Fixnum#[]
3.95 36.66 2.22 1000 2.22 4.19 Date#civil_to_jd
3.01 38.35 1.69 2000 0.85 7.94 Rational#/
2.48 39.74 1.39 23000 0.06 1.27 Fixnum#-
2.14 40.94 1.20 19000 0.06 0.06 Kernel.kind_of?
Seems like its inherent in dealing with dates. I wonder if you can turn
of reducing action for a while.
--
David Heinemeier Hansson,
http://www.basecamphq.com/ -- Web-based Project Management
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://macromates.com/ -- TextMate: Code and markup editor (OS X)
http://www.loudthinking.com/ -- Broadcasting Brain
More information about the Rails
mailing list