[Python-Dev] _socket efficiencies ideas

Guido van Rossum guido@python.org
Wed, 09 Apr 2003 09:51:26 -0400


> On Tue, Apr 08, 2003 at 10:50:50AM -0400, Guido van Rossum wrote:
> >Are you sure that it tries make a DNS call even when the address is
> >pure numeric?  That seems a mistake, and if that's really happening, I
> 
> My first thought is that there should be a local DNS cache on the
> machine that is running these apps.  My second thought is that Python
> could benefit from caching some lookup information...

I don't want to build a cache into Python, it should already be part
of libresolv.

> >address is purely numeric.  I'd be happy to see a patch that
> >intercepts addresses of the form \d+\.\d+\.\d+\.\d+ and parses those
> >without calling getaddrinfo().
> 
> It's not quite that easy.  Beyond the IPV6 issues mentioned elsewhere,

The IPv6 folks can add their own cache.

> you'd also want to check "\d+.\d+" and "\d+\.\d+\.\d+".  IP addresses
> will fill in missing ".0"s, which is particularly handy for accessing
> "127.1", which gets expanded to "127.0.0.1".

I didn't even know this, and I think it's bad style to use something
that obscure (most people would probably guess that 127.1 means
0.0.127.1 or 127.1.0.0).

But since you seem to know about this stuff, perhaps you can submit a
patch?

--Guido van Rossum (home page: http://www.python.org/~guido/)