From: Bill Kelly Date: 2007-11-15T03:32:11+09:00 Subject: Re: ruby incredibly slow (update 2) From: "Ron Jeffries" > > When in the Rails ruby folder, we run > ruby runner.rb ruby > Chet's machine takes about 6 seconds, and mine takes 93 seconds. This may be like 'slaking a thirst with a firehose', but... Maybe instrumenting runner.rb with a trace function: def __trace_on__ trace_proc = proc do |event, file, line, id, binding, classname| return if file =~ %r{lib/ruby/} trace_str = sprintf( "%14.3f %8s %s:%-2d %10s %8s <%d>", Time.now.to_f, event, file, line, id, classname, Thread.current.object_id ) $stderr.puts trace_str end set_trace_func trace_proc end def __trace_off__ set_trace_func nil end __trace_on__ ... This will output a LOT of information, tracing each line of code executed and printing a timestamp. But maybe it might reveal something about where the slowdown is occurring. (If the tracing itself doesn't add so much overhead as to mask the problem .) Note that by default, to cut down on the spam, I have the trace func ignore files having lib/ruby/ in their path. You may need to modify that if you aren't seeing the output you're interested in. Hope this helps, Bill