performance question

klochner
Thu, 27 Jan 2011 18:29:07 -0000

I got sidetracked while benchmarking ruby factorial code:
http://rosettacode.org/wiki/Factorial#Ruby

I put all that code into test_fact.rb and ran with:

> ruby test_fact.rb
> rails runner test_fact.rb  #from a fresh rails app
> rails runner test_fact.rb #from a mature rails app

here are the respective results:

                  user     system      total        real  #ruby
recursive:    8.660000   0.040000   8.700000 (  8.888191)
iterative:      6.770000   0.030000   6.800000 (  6.892491)
functional:   6.240000   0.030000   6.270000 (  6.334801)

                  user     system      total        real # rails
runner fresh
recursive:   10.140000   0.070000  10.210000 ( 10.760008)
iterative:      8.750000   0.050000   8.800000 (  9.050677)
functional:   8.200000   0.040000   8.240000 (  8.477966)


                  user     system      total        real #rails runner
mature
recursive:   17.400000   0.170000  17.570000 ( 17.792121)
iterative:   15.730000   0.140000  15.870000 ( 16.233311)
functional:  15.450000   0.160000  15.610000 ( 16.245557)

I profiled it as well and the function calls were identical, just
slower.

This feels like a ruby issue that rails brings out in spades, I''m
wondering if anyone here has some insight as to what''s going on.

 - kevin

--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at