From: Adiel Mittmann Date: 2011-03-16T21:30:11+09:00 Subject: Re: NoMethodError#message takes very long Hello. On Wed, Mar 16, 2011 at 09:08:42PM +0900, Robert Klemme wrote: > Additional remarks: the file is not properly closed and reading the > whole file in one go is probably also not a good solution. I'd rather > > require 'sinatra' > require 'nokogiri' > get '/' do > @xml = File.open('baz.xml', 'rb') {|io| Nokogiri::XML(io)} > foo() > 'hello' > end > > Note, the fact that you read in a large file as one String can > actually be related to your slowness because it might case GC > overhead. That is indeed a better way to read the file, thanks for pointing it out. The same problem happens with the code you suggested, however. In any case, did you test any of the variants? Was it very slow as in my case? Thank you for your reply. -- Adiel Mittmann