This project is archived and is in readonly mode.
script/console execs irb, causes double process-launch and limits other impls
-
Charles Oliver Nutter
I just noticed that the script/console script also requires config/boot, which means that the exec is also causing a second load of Rails and the application. So this fix would potentially improve the startup time of the console on all implementations.
-
Repository
- State changed from new to committed
(from [3b169cd693f45911ee71e26708fb9267811c8d83]) Speed up script/console by launching IRB directly.
[#2104 script/console execs irb, causes double process-launch and limits other impls state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...
-
JasonKing
Fix for the bug iffy mentions here: http://github.com/rails/rails/co...
-
CancelProfileIsBroken
- Assigned user set to Jeremy Kemper
- State changed from committed to open
- Milestone cleared.
-
Repository
(from [04fdb6eccb3a49b26bdbf779031f427da23a8bb4]) Revert "Speed up script/console by launching IRB directly."
[#2104 script/console execs irb, causes double process-launch and limits other impls state:open]
This reverts commit 3b169cd693f45911ee71e26708fb9267811c8d83. http://github.com/rails/rails/co...
-
Charles Oliver Nutter
I noticed the whole commit was reverted, even though a fix was proposed. Is there something else wrong with the change?
-
Jeremy Kemper
The fix doesn't work. The environment has already been loaded by boot.rb at that point.
-
JasonKing
Umm, my fix does work, it moves the command line arg parsing into railties/bin/console before the boot is loaded.
-
Jeremy Kemper
Sorry Jason, I misread your patch.
-
Jeremy Kemper
- Milestone set to 2.x
Postponing this since existing apps' script/console will appear to work but load the wrong environment. Fixing it will require everyone to
rake rails:update:scriptswhich hasn't been part of the 2.3 RC. -
Charles Oliver Nutter
Couldn't the new console behavior be added in a different file, and new script/console require that one instead? Then the old behavior would still work in existing apps and newly-generated apps would get the new behavior, starting up fastest, etc.
I'd really like to see this get into 2.3.
-
buddy12lbcat
- Tag changed from console, irb, jruby to console, irb, jruby, ruby1.9
hi, i wanted to add my 2 cents by saying that this issue should include the use of /usr/bin/env ruby sherbangs in multiple files. i need to be able to support a custom compiled ruby1.9 on production servers that use 1.8 system gems. unfortunately, console, dbconsole, and lots of other scripts use env to load (for me) the wrong ruby.
i just returned from dhh and was inspired by his "have it your way" speech. in light of this, why can't we just have an optional RUBY_PATH constant that can be set explicitly if i need to. without it, the scripts do as expected, but if present, it just loads everything from that directory. this seems much cleaner and incurs less overhead than doing all manner of gyrations to "detect" ruby automagically.
i guess i don't believe that convention over configuration means no explicit configuration at all. however implemented, it should be a clean one-line explicit statement.
-
buddy12lbcat
ok. so not to be a whiner without a solution, i've patched my rails to do the following:
1) symlink /usr/local/ruby/bin -> /usr/local/ruby//bin
2) replaced all /usr/bin/env ruby sherbangs with /usr/local/ruby/bin/ruby
3) added RUBY_PATH = '/usr/local/ruby/bin' to boot.rb
4) changed console.rb and other references to RUBY_PLATFORM to say irb = "#{RUBY_PATH}/irb" || RUBY_PLATFORM ...not sure if this is generalizeable to other systems, but it seems to take care of most of my issues and allows me to switch ruby versions with just the symlink. i kept the symlink off the usual paths so it doesn't screw with my production 1.8 gems/paths. at the very least this will give me experience maintaining my own rails patches via git clone/rebase. :)
-
buddy12lbcat
sorry looks like lighthouse monkeyed with my post. #1 Migrations will not run on a fresh database should say: symlink /usr/local/ruby/bin -> /usr/local/ruby/1.9.1-p129/bin
-
buddy12lbcat
ok. so maybe rails has done this before :) turns out that if you use rails -r /path/to/ruby it will reset all your shebangs. so don't need that. i have legacy code and don't run rails to create new projects at all so i missed that option. so that just leaves console using path/irb. i defer to the great oz that is rails core.
-
Rohit Arondekar
Any updates to this ticket?
-
Jeremy Kemper
- Milestone cleared.
-
Ryan Bigg
Automatic cleanup of spam.
-
Charles Oliver Nutter
Any chance of getting this prioritized some day? JRuby itself starts up pretty fast, Rails less so...and with this double-booting it's almost unbearable.
Here's a gist showing the differing times from starting up IRB alone, IRB with RubyGems (with a tweak in my env to speed it up), IRB with RubyGems and boot.rb, and the Rails 3 console. Compared to IRB alone, Rails 3's console takes an order of magnitude longer to start up, and compared to IRB + boot.rb, it's almost 2x, as you'd expect from double-initializing.
-
Charles Oliver Nutter
Also, to make it sound less snarky...I'd happily work with someone to get an acceptable patch put together.
-
Jason King
I haven't really begun digging around in Rails3 yet, but I'm pretty sure your benchmarks should be including
config/application.rbnotconfig/boot.rb. I think you'll get much more similar times then becauseboot.rbis only doing the Bundler setup now.You'll get more similar times because... I think your change has been included in Rails3 as part of their general improvements. Looking in railties/lib/rails/commands/console.rb I see
IRB.startnow.
