分享 [Blog 搬运] Please Tweak Your GC Settings for Tests!

fredwu · 2013年09月06日 · 最后由 xstmjh 回复于 2013年09月08日 · 2202 次阅读

Blog 搬运

It was made apparent to me that many ruby devs either aren’t aware or couldn’t be bothered to tweak their ruby garbage collector settings.

Well, if you are using MRI, please start tweaking your GC settings. Here’s what I use (on my 15” Macbook Pro Retina):

export RUBY_GC_MALLOC_LIMIT=90000000
export RUBY_FREE_MIN=200000

Not only can you tweak it for your local dev machine, you can also tweak Jenkins, Travis CI, Wercker and other CI solutions, making instant speed gain for your test suite!

Here’s what we get:

             Before   After
Local:       8m22s    5m52s
Travis CI:   10m10s   6m0s
Wercker:     8m45s    6m24s

YMMV depending on your system and available RAM.

弱弱的问下,这是要在哪设置?要重编译 ruby 么?为啥我在 shell 里面 export 后测试速度没啥显著区别……

#1 楼 @aptx4869 直接 export 就可以了不需要重新编译。如果没有明显区别的话可以尝试修改一下参数。根据系统和内存的区别,也许提升不了了。

一般 jenkins 和 travis 效果会明显点,本来就慢

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