Live data from Hacker News

Rails 3 Performance - Not Good Enough

blog.tstmedia.com

121–130 of 142 posts

Re: Rails 3 Performance - Not Good Enough

#121
post #111
post #53

I've been a Rails dev for 5 years. I'm frequently considering leaving for another framework because of one thing: bootstrap time. Starting a test or server on my dev machine takes 20-30 seconds. Particularly with tests, this is a huge problem for doing proper TDD, particularly when you are trying to use tests to track down a bug. In that 20-30 seconds, I often console myself that we no longer need to print punch card…

I have investigated this in detail and the reason for this is really ridiciulous - 80% of this time is spend on executing "require" statements and this is due to really bad design of RubyGems and/or Bundler. They both do their job by augmenting $LOAD_PATH to include all directories containing gem contents. If you then look into how Ruby deals with the $LOAD_PATH, it turns out each time you do a "require" it will go t…

I started https://github.com/joevandyk/slow-rails to look into this. It's an empty Rails project, except for the Gemfile and one model.

Re: Rails 3 Performance - Not Good Enough

#123

The benchmark was done using REE. Out of curiousity, I tried it with MRI 1.8.7, MRI 1.9.2, and REE 1.8.7. Results are best out of three: user system total real rails3-1.9.2 2.240000 0.200000 2.440000 ( 3.127072) rails2-ree 2.530000 0.290000 2.820000 ( 3.578471) rails2-1.8.7 2.920000 0.210000 3.130000 ( 3.876215) rails3-ree 3.140000 0.250000 3.390000 ( 4.111465) rails3-1.8.7 3.560000 0.220000 3.780000 ( 4.505166) Of c…

1.9.2 has some slow startup problems with rails 3 -- I don't believe your benchmark measures startup time.

It's aimed at an issue with ActiveRecord. Like I said, it doesn't mean that Rails 3 on MRI 1.9.2 is faster than Rails 3 on REE.

Also, just to be clear, I'm not the author of the linked post or the benchmark.

Re: Rails 3 Performance - Not Good Enough

#124
post #111

Earlier quoted context omitted.

I have investigated this in detail and the reason for this is really ridiciulous - 80% of this time is spend on executing "require" statements and this is due to really bad design of RubyGems and/or Bundler. They both do their job by augmenting $LOAD_PATH to include all directories containing gem contents. If you then look into how Ruby deals with the $LOAD_PATH, it turns out each time you do a "require" it will go t…

I started https://github.com/joevandyk/slow-rails to look into this. It's an empty Rails project, except for the Gemfile and one model.

Here's 1.8.7, 1.9.2, and 1.9.3dev running that application's test:

https://img.skitch.com/20110515-x4r8414pkei9j3h73d1sy67iud.j...

1.9.2 and 1.9.3 is really slow at starting up bundler/rails/gems.

Re: Rails 3 Performance - Not Good Enough

#125
post #98

Earlier quoted context omitted.

True that gems often do more than I need, but should I? 1) Write my own authentication code 2) Write my own ical feed code (just added this in about 2 hours using ri_cal, which has way more features than I need) 3) Write my own code to inline css in email 4) Write my own Facebook API library 5) Write my own admin interface 6) Write my own SCSS and HAML processors 7) Write my own file attachment and processing code 8)…

That's only 9 libraries, and that shouldn't be enough to cause your load times to reach 20-30 seconds. Also, since you asked :-) I would question #5. Auto admin libraries (and this applies to multiple languages and frameworks) are generally heavy, too general and have code hidden away in the library. In contrast, banging out crud views and controllers in a locked-down namespace is easy, only relies on same dependenci…

It would take me many days to create and test an admin with multiple objects, even a simple one, and then I have to maintain it. I install rails_admin and I've got what I need. This is for internal testing and maintenance. I don't care if it's heavy.

I suppose your logic makes sense if you're gainfully employed, but I bang this stuff out for myself and clients. A 90% solution with one line of code sure beats weeks of work.

Re: Rails 3 Performance - Not Good Enough

#126
post #53

I've been a Rails dev for 5 years. I'm frequently considering leaving for another framework because of one thing: bootstrap time. Starting a test or server on my dev machine takes 20-30 seconds. Particularly with tests, this is a huge problem for doing proper TDD, particularly when you are trying to use tests to track down a bug. In that 20-30 seconds, I often console myself that we no longer need to print punch card…

I was at the BBC working on a large Perl codebase which was a fairly typical Catalyst/DBIx::Class stack. It had thousands of tests which thanks to the foolish way we loaded reference data and pre-populated memcache etc. had the test suite running for 3 hours . As you can imagine, it was a nightmare for TDD and indeed for large merges (by the time you've run tests trunk would have inevitably changed). We never fixed i…

> with a test suite that takes less than a second to run

I'm jealous. That would probably save me a huge portion of my development time. Node is my top contender if I dump rails.

Re: Rails 3 Performance - Not Good Enough

#127
post #59

Earlier quoted context omitted.

You can drive a car without knowing how an engine works. But you can't design a [good] car without that knowledge.

I'm not convinced analogies such as this are particularly useful. I'm pretty sure you could design a perfectly good car by treating an engine as a black box with a clearly defined set of inputs an outputs without caring how those inputs are translated in the outputs. Which is the goal of a framework such as rails.

But I doubt that you could maintain it without knowing how it worked. The moment anything went wrong, you would be in trouble.

I'm sure you could build a car that looked pretty, but not one that ran well.

Re: Rails 3 Performance - Not Good Enough

#128
post #53

I've been a Rails dev for 5 years. I'm frequently considering leaving for another framework because of one thing: bootstrap time. Starting a test or server on my dev machine takes 20-30 seconds. Particularly with tests, this is a huge problem for doing proper TDD, particularly when you are trying to use tests to track down a bug. In that 20-30 seconds, I often console myself that we no longer need to print punch card…

I just tested this on one of my apps (yakkstr.com) and 'rails c' and 'rails s' both startup in about 5 seconds. I'm on 1.8.7 and rails 3, not sure if that makes a difference, but 20-30 seconds doesn't mesh with my experience at all.

I'm on a 2.66 GHZ i5 imac, not an SSD.

Re: Rails 3 Performance - Not Good Enough

#129
post #128
post #53

I've been a Rails dev for 5 years. I'm frequently considering leaving for another framework because of one thing: bootstrap time. Starting a test or server on my dev machine takes 20-30 seconds. Particularly with tests, this is a huge problem for doing proper TDD, particularly when you are trying to use tests to track down a bug. In that 20-30 seconds, I often console myself that we no longer need to print punch card…

I just tested this on one of my apps (yakkstr.com) and 'rails c' and 'rails s' both startup in about 5 seconds. I'm on 1.8.7 and rails 3, not sure if that makes a difference, but 20-30 seconds doesn't mesh with my experience at all. I'm on a 2.66 GHZ i5 imac, not an SSD.

Would you mind testing out https://github.com/joevandyk/slow-rails and see how long 'rake' takes to run?

For me on 1.8.7, it takes about 7-8 seconds. Annoying because the application is empty, it's just 28 gems being loaded. On 1.9.2, it's 20 seconds or so.

Re: Rails 3 Performance - Not Good Enough

#130

Earlier quoted context omitted.

I started https://github.com/joevandyk/slow-rails to look into this. It's an empty Rails project, except for the Gemfile and one model.

Here's 1.8.7, 1.9.2, and 1.9.3dev running that application's test: https://img.skitch.com/20110515-x4r8414pkei9j3h73d1sy67iud.j... 1.9.2 and 1.9.3 is really slow at starting up bundler/rails/gems.

Ok so first this is not exactly an empty Rails project. The Gemfile.lock has 221 lines, that amount of dependencies is not normal. To compare the application code for http://www.getharvest.com/ a +5 year old rails project with customers et all and it has 245 gem dependencies (including some that are our own). The +3 year old http://www.coopapp.com has 181 dependencies. Both of these start up within 3-4 seconds on my desktop and due to their age & size they have admitedly too many dependencies. Everytime one is removed I've rejoice.

Please don't call something with 221 dependencies a blank Rails project. More the amount of conflicting half baked gems you've added makes it an unfair complaint about Rails. I've assure you that there is no language / framework in the universe in which does not take a hit when adding too many dependencies. Either execution wise but more often it just breaks your spirit.

Anyway back to numbers, on 3 year old desktop under Linux, executing tests on the "blank" project yielded:

real    0m8.698s
user    0m5.996s
sys     0m2.532s

For some reason ruby is much slower on OSX than linux, that is an interesting project to investigate. I've think the platform difference shows the 10 second difference, spite the slower CPU. It would be quite interesting to understand why ruby is slow on OSX. Each to his own itch to scratch.

Post reply on HN