I have a problem with Ruby on Rails, which is very slow. I am using Ruby 2.1.3p242 and Rails 4.2.1 on a computer running Windows 8.
Whenever I run everything that requires loading rails (including tests), it takes a lot of time to start and run. I put some calls in Benchmark in config / environment.rb on a clean rails setup:
require File.expand_path('../application', __FILE__) User cpu System Cpu Total Cpu elapsed time 0.000000 0.000000 0.000000 (0.000000) Rails.application.initialize! 15.282000 2.891000 18.173000 ( 18.201173)
Clearly, Rails.application.initialize takes an absurdly long time, considering it a clean install.
Thank you in advance for your help.
Edit-1: I work on a dual-core i3 4010u@1.7GHZ with 4 GB of RAM. I donโt think my car is too bad, as it works very well.
Edit-2: I ran ruby-prof on Rails.application.initialize and found the culprit. The process took 85% of the execution time:
<Module::SecureRandom>#random_bytes <Module::OpenSSL::Random>#random_bytes
This apparently happens in Ruby21/lib/ruby/2.1.0/securerandom.rb#62 I looked at line 62 in this file, and here is what I found:
return OpenSSL::Random.random_bytes(n)
So does anyone know what that means?
source share