Slow 'require' ?!

Hi,
I’m using JRuby 1.1.1 on Linux and performance after startup is very
good.
But loading ruby libs by ‘require’ is very slow.
Sometimes I have to wait several seconds …

TEST

def duration(&code)
start_time = Time.now.to_f
code.call
Time.now.to_f - start_time
end

dur = duration { require ‘pp’ }
puts “require pp: #{dur}”

dur = duration { require ‘yaml’ }
puts “require yaml: #{dur}”

dur = duration { require ‘rubygems’; require ‘log4r’ }
puts “require log4r: #{dur}”

JRuby 1.1.1

require pp: 0.303

require yaml: 0.800

require log4r: 0.677

Ruby 1.8.6

require pp: 0.015

require yaml: 0.030

require log4r: 0.058


Any suggestions or hints??
Thanks

Andreas H.


View this message in context:
http://www.nabble.com/slow-'require'--!-tp17146121p17146121.html
Sent from the JRuby - User mailing list archive at Nabble.com.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Fri, May 9, 2008 at 6:31 AM, Andreas H. [email protected] wrote:

Time.now.to_f - start_time

Any suggestions or hints??

On initial startup of JRuby many pieces of java code have not been
running long enough to get dynamic optimizations yet and requires
usually happen at the start of JRuby. Our parser is also quite a bit
slower than MRI. That may or may not explain the difference. You
could help try and isolate what is taking the most time, but that
requires digging into the Java code and perhaps using a profiler to
see what is going on.

-Tom


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: [email protected] , [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs