From: Robert Klemme Date: 2011-03-16T21:26:48+09:00 Subject: Re: NoMethodError#message takes very long On Wed, Mar 16, 2011 at 1:15 PM, Adiel Mittmann wrote: > Hello. > > On Wed, Mar 16, 2011 at 03:24:29PM +0900, Eric Hodel wrote: >> Let me see if I have this straight: >> >> If baz.xml is empty it is fast >> If baz.xml is large it is slow >> >> If this is true it is because it takes time to parse the XML file before it gets to foo and discovers that there is no method foo. >> >> Ruby does not know that foo does not exist until you try to call it. > > The thing is: if method foo is not called at all, and thus no exception is > raised, the resulting web page is shown quickly enough. Nokogiri is pretty fast > at parsing XML files. > > It only takes long when the inexistent method foo() is called and the pogram > tries to print the exception message. > > Yes, I know this is *very*, *very* weird. Can anybody try to reproduce this bug? > The code snippet is very simple and it shouldn't take more than a couple > minutes. Not if one does not have the environment installed. Did you try the suggested change? Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/