Ruby 还没用上 Falcon 补丁的可以去装了哦~

fredwu · 2012年11月26日 · 最后由 hpyhacking 回复于 2012年12月05日 · 5361 次阅读

https://gist.github.com/4136373

我们的 test suite,前后对比。

之前——

正常运行:95.72s in-memory 运行:76.34s

patch 之后——

正常运行:78.62s in-memory 运行:57.27s

:-)

Cool! For rvm user:

rvm get head && rvm install 1.9.3 1.9.3-p327-falcon --patch falcon

我也来一份

#1 楼 @ashchan 就等你这一行 +1

这个和 railsexpress 的 patch 有什么差别?

#5 楼 @huacnlee 哈,真不错。不过我这边直接连原始地址会快的多。主要时间花在编译上。

匿名 #8 2012年11月27日

好东西

rvm get head // open new shell rvm reinstall 1.9.3 -p falcon

and more: https://gist.github.com/4136373

我用 rvm reinstall 1.9.3 -p falcon 报错,正用 rvm reinstall 1.9.3 --patch falcon 安装中

用上这个以后,passenger 的 gem 安装会报错误,必须要带上--pre 安装测试版本的才可以,注意一下。

效果:

$ rvm use ruby-1.9.3-p194
$ time rails runner "puts :OK"
OK
rails runner "puts :OK"  6.00s user 3.30s system 19% cpu 47.955 total

$ rvm use ruby-1.9.3-p327-falcon
$ time rails runner "puts :OK"  
OK
rails runner "puts :OK"  3.49s user 1.83s system 50% cpu 10.559 total

装不上,大家没用 clang?

Building 'ruby-1.9.3-p327-falcon' using clang - but it's not (fully) supported, expect errors.
Installing Ruby from source to: /Users/roymax/.rvm/rubies/ruby-1.9.3-p327-falcon, this may take a while depending on your cpu(s)...
ruby-1.9.3-p327-falcon - #downloading ruby-1.9.3-p327, this may take a while depending on your connection...
ruby-1.9.3-p327-falcon - #extracting ruby-1.9.3-p327 to /Users/roymax/.rvm/src/ruby-1.9.3-p327-falcon
ruby-1.9.3-p327-falcon - #extracted to /Users/roymax/.rvm/src/ruby-1.9.3-p327-falcon
Applying patch /Users/roymax/.rvm/patches/ruby/1.9.3/p327/falcon.diff
ruby-1.9.3-p327-falcon - #autoreconf
Error running 'autoreconf', please read /Users/roymax/.rvm/log/ruby-1.9.3-p327-falcon/autoreconf.log
ruby-1.9.3-p327-falcon - #configuring
Error running './configure --enable-shared --disable-install-doc --prefix=/Users/roymax/.rvm/rubies/ruby-1.9.3-p327-falcon --with-opt-dir=/Users/roymax/.rvm/usr', please read /Users/roymax/.rvm/log/ruby-1.9.3-p327-falcon/configure.log
There has been an error while running configure. Halting the installation.
Ruby 'ruby-1.9.3-p327-falcon' was built using clang - but it's not (fully) supported, expect errors.

#13 楼 @roymax brew install automake 和 autoconf 试试

参考http://astrails.com/blog/2012/11/13/rvm-install-patched-ruby-for-faster-rails-startup 加个参数竟然过了,-n falcon参数是什么意思?

rvm get head && rvm install 1.9.3 1.9.3-p327-falcon --patch falcon -n falcon

$ time rails runner "puts :OK"
OK
rails runner "puts :OK"  6.32s user 1.37s system 92% cpu 8.292 total

$ rvm use ruby-1.9.3-p327-falcon
$ time rails runner "puts :OK"  
OK
rails runner "puts :OK"  3.75s user 0.96s system 99% cpu 4.752 total

$ export RUBY_HEAP_MIN_SLOTS=1000000
$ export RUBY_HEAP_FREE_MIN=500000
$ export RUBY_HEAP_SLOTS_INCREMENT=1000000
$ export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
$ export RUBY_GC_MALLOC_LIMIT=100000000

$ time rails runner "puts :OK"            
OK
rails runner "puts :OK"  3.18s user 1.02s system 99% cpu 4.234 total

标记一下。寻收藏有点幸苦。图片太不起眼了。

在我的 mac 上,对 zeus start 的加速是非常可观的

找个项目简单对比了下:

rvm-use-ruby-1.9.3-p194
rspec spec/models/
Finished in 45.81 seconds
70 examples, 0 failures, 2 pending

rvm-use-ruby-1.9.3-p327-falcon
rspec spec/models/
Finished in 32.36 seconds
70 examples, 0 failures, 2 pending

效果杠杠的!

太神奇了,mark 一下

需要 登录 后方可回复, 如果你还没有账号请 注册新账号