From: Yura Sokolov Date: 2012-02-04T14:54:57+09:00 Subject: [ruby-core:42350] [ruby-trunk - Feature #5767] Cache expanded_load_path to reduce startup time Issue #5767 has been updated by Yura Sokolov. https://gist.github.com/1688857 Most of success of that gist is cause of this issue. Cites from comments: Thanks for sharing that. Indeed the speed increase is quite impressive! I've tested the time it take to run some rspec test before and after. Here are the results: Before: Finished in 402.79 seconds (3521 examples, 3 failures, 39 pending) After: Finished in 222,82 seconds (3521 examples, 3 failures, 39 pending). WOOW! ------ Obligatory benchmarks: Test Suite on 1.9.3-p0 proper : 2m06s Rails boot time : 9.1s Suite on 1.9.3-p0-perf : 1m32s Rails boot time : 6.5s Not bad. ------ $ time rake before: real 0m37.919s user 0m6.474s sys 0m0.919s after: real 0m34.236s user 0m3.367s sys 0m0.848s $ time rails runner "Time.now" before: real 0m4.589s user 0m3.871s sys 0m0.629s after: real 0m2.437s user 0m1.889s sys 0m0.534s ------ 5.5 secs instead of 8.8 secs for rails runner "puts \"omfg\"" rspec . 15.1 seconds instead of 18.2 seconds ------ One of my Rails apps, boot time (measured with ./bin/rails runner 'puts 3' 1.9.3-perf: 5.1 seconds 1.9.3-p0: 8.1 seconds 1.9.2-p290: 18.2 seconds ------ My rake parallel:spec went down from 68 to 38sec!!!!!!!!!! That's 44% cut off! Fantastic! THANK YOU! ------ API spec tests ~30% faster! ------ time bundle exec rake environment Before: 14.60s user 1.26s system 100% cpu 15.861 total After: 5.11s user 1.10s system 99% cpu 6.212 total 60.8% speedup!!!!!! ------- ---------------------------------------- Feature #5767: Cache expanded_load_path to reduce startup time https://bugs.ruby-lang.org/issues/5767 Author: Yura Sokolov Status: Open Priority: Normal Assignee: Category: Target version: This patch add caching of expanded load path. It reduces rails startup time by 33% (patch against 1.9.3-p0 and simple performance test is here https://gist.github.com/1480404 ) -- http://bugs.ruby-lang.org/