« Moon, attempt #1 | Main | Leopard Ruby and Oniguruma gem »

November 09, 2008

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e552517e378834010535e572e2970c

Listed below are links to weblogs that reference Rail's Dev Mode Performance Plugin:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

roger

I assume no go with 2.1/2.2?
I like this patch--my equivalent of it was to run in production mode and kill the server whenever any files changed :)
-=R
http://code.google.com/p/ruby-roger-useful-functions/source/browse/trunk/rails/rails_useful.rb

Josh Goebel

Why do you think it wouldn't work with 2.1? I'd imagine it'd work with any of the 2.1.x series, though I've only tested with the later bug fix releases. 2.2 I have no idea but someone is welcome to test it out and file a bug report on Lighthouse if there are any issues - or submit patches. :-)

Morten

Hey Josh, nice work - happy to see this on Rails 2! It's a bit spammy though, I see a ton of these on 2.1.2:

DEPRECATION WARNING: Dependencies is deprecated! Use ActiveSupport::Dependencies instead. See http://www.rubyonrails.org/deprecation for details. (called from included at /vendor/plugins/rails_dev_mode_performance/lib/dep_hacks.rb:183)

I skimmed the plugin code, and see that you do use ActiveSupport::Dependencies on some locations, but not all, so I'm wondering if there's a deeper reason for this, or it's just a "todo" thing.

Josh Goebel

No reason. I hadn't noticed the warning when playing around. Simple enough patch though - you can fetch the latest from git.

David Reese

Great idea...

FYI, tried it with edge (2.2?) and it crashes on start... the template finder seems to rely on some 2.1 file_exists? method, which has been refactored away in 2.2.

Actually, the whole TemplateFinder module is gone in edge. I'm sure someone more familiar with those changes would be more successful than I was in getting it to work :(

[ps, "TemplateFinder and it's dev mode performance issues" -- http://www.37signals.com/svn/posts/1302-its-not-its ]

Josh Goebel

"its" and "it's" have to be one example of the English language being totally f-ed up and inconsistent. 's is used everywhere else to indicate possession so instead of vilifying this edge case the language should just be changed to allow both uses. In most cases that doesn't lead to ambiguity.

Josh Goebel

When 2.2 is released I will vet the plugin against it. For now please test with 2.1.2 or try commenting out the hack for TemplateFinder.

David Reese

Commenting out the template_finder_hacks in init.rb makes it work great with edge. Works great even with the Engines plugin -- not sure why but I was surprised to see my engine-ized plugin app/ directory reload as needed!

>15x speed improvement!

Tony Buser

I just tried it on a rails 2.0.5 project and it crashes on start saying this:

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.5/lib/active_support/dependencies.rb:266:in `load_missing_constant': uninitialized constant ActiveSupport::Dependencies (NameError)
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.5/lib/active_support/dependencies.rb:453:in `const_missing'
from /Users/abuser/Code/unconundrum/intranet/vendor/plugins/rails_dev_mode_performance/lib/dep_hacks.rb:1
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.5/lib/active_support/dependencies.rb:496:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.5/lib/active_support/dependencies.rb:342:in `new_constants_in'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.5/lib/active_support/dependencies.rb:496:in `require'
from /Users/abuser/Code/unconundrum/intranet/vendor/plugins/rails_dev_mode_performance/init.rb:8:in `evaluate_init_rb'
... 38 levels...
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.5/lib/commands/server.rb:39
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
from script/server:3

Chris

It's / its is consistent with who's / whose, he's / his, she's / hers, etc. So, yeah, no :)

Josh Goebel

It's not the same at all... they purposely avoid the problem entirely by changing the form of the word.

* hes going -> his moped
* shes running -> her car
* whos there -> whose publication
* its 5-oclick -> its error

In the first 3 cases (apostrophe dropped on purpose) there is a very clear difference and not even the opportunity for this kind of mistake. The last two will always be a toss up in my opinion.

David Vrensk

We're still on Rails 2.1.0, and to make it work I had to change

ActiveSupport::Dependencies

to just

Dependencies

in 8 places in dep_hacks.rb. Once I do that it works great. We have 80-something models and it's a huge difference for us.

The following commit to ActiveSupport (4 days after 2.1.0) explains why I had to make the changes:

http://github.com/rails/rails/commit/c08547d2266c75f0a82d06dd91c6d0500740e12e

I notice that there is a rails2_1 tag at github, but perhaps it should be called rails2_1_2 instead.

David Vrensk

...and I had to make the same change in dispatcher_hacks.rb.

Tom

Oh wow this is *exactly* what I need for Hobo. Hobo does a TON of extra stuff in dev mode compared to Rails, and performance can be really painful.

Really looking forward to trying this out...

The comments to this entry are closed.

About the Author

Rails and Ruby Projects