rubí requiere muy lento

I have a ruby script running on an ec2 small instance running ubuntu 10.10 and ruby 1.9.2p0 (no rails)

I am requiring a few files on top and dying directly afterwards to test the speed. Two gems are taking a lot of time to load.

This is the list of gems i'm loading:

require 'rubygems'
require 'active_record'
require 'yaml'
require 'json/pure'
require 'logger'
require 'aws'
require 'time'

running the file and dying right after the requires takes 2.3 seconds

without active_record it will run in 1.4 seconds without aws it will run in 1.1 seconds

and without both aws and active_record it will run in 0.3 seconds

I am new to ruby coming from php and expected it to be faster. Are these load times normal or there's something wrong with my setup?

preguntado el 09 de marzo de 12 a las 16:03

Might have to do something with this (rails example, but a ruby issue): rhnh.net/2011/05/28/acelerando-el-tiempo-de-arranque-de-rieles. Any reason you can't use 1.9.3? -

@Thilo looks like the same issue. 1.9.2 is the the version that comes with the ubuntu version running on the server. will look into updating.. -

Agreed, upgrade to 1.9.3 if possible as load time is significantly improved. -

That's about right -- on my computer running 1.9.3-p125 it takes 2.8 seconds to require all those gems. Keep in mind that requiring ActiveRecord also requires ActiveSupport. Both are pretty large libraries in Ruby-land. -

1 Respuestas

I'm running ruby 1.9.3p194 on 64-Bit Arch Linux and require 'active_record' takes about 1.5 seconds, so I think it's normal.

contestado el 12 de mayo de 12 a las 13:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.