From: domingo@... (Domingo Alvarez Duarte) Date: 2002-04-03T19:15:19+09:00 Subject: Re: Cutting 120 ms in mod_ruby,postgresql on an AMD500 Sorry but I've got an error using cgi/session when there is no cookie already seted in the browser to correct it do the following in cgi/session initialize: ------------------------ id, = request[session_key] unless id #id, = request.cookies[session_key] # original line #comment the above line and add the lines bellow to next comment begin id = request.cookies[session_key].value[0] #DAD rescue NameError id = nil end #end new code end -------------------------- As well looking at delegate.rb I could see that doing a small change we can improve the performance of it (but still is too much for me, it decreases the time spent on it 25%). In Delegate::initialize -------------------------- #add the line bellow to store the methods definitions and # skip call eval one time for each one eval_methods = '' for method in obj.methods next if preserved.include? method # here store the methods definition all together to evaluate # all once at the end eval_methods << <<-EOS def self.#{method}(*args, &block) begin __getobj__.__send__(:#{method}, *args, &block) rescue Exception $@.delete_if{|s| /:in `__getobj__'$/ =~ s} #` $@.delete_if{|s| /^\\(eval\\):/ =~ s} raise end end EOS end # and here outside the loop evaluate all methods at once # with around 25% less cpu time eval(eval_methods) ------------------ The above could make a general performance improvement in ruby programs that relay heavilly on delegation. Again I hope that this will help someone.