From: Bill Kelly Date: 2007-11-15T12:59:29+09:00 Subject: Re: ruby incredibly slow (update 2) From: "Ron Jeffries" > > On Wed, 14 Nov 2007 22:27:46 -0500, Ron Jeffries > wrote: > >>On Wed, 14 Nov 2007 14:03:36 -0500, Eric Hodel >>wrote: >>> >>>$ time ruby -rsocket -e 'p Socket.gethostbyname("127.0.0.1")' >>>["localhost", ["test"], 2, "\177\000\000\001"] >>> >>>real 0m0.042s >>>user 0m0.010s >>>sys 0m0.009s >> >>It's a solid 8 seconds on my machine. But ordinary web page access is >>nothing like that. What is this telling us? > > I flushed dns cache (windows xp), same result. changed from system > default DNS to some specific known DNS servers. Same result. Weird. Not sure this would make any difference, but, might try adding this at the beginning of your program: require 'resolv-replace' It patches a pure-ruby DNS resolver implementation in place of IPSocket#getaddress, etc., instead of using the blocking system call. Also, is `nslookup.exe` fast when invoked from a command prompt? Regards, Bill