socket.gethostbyaddr() is slower than Christmas

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Wed Jul 17 21:32:10 EDT 2002


That sounds similar to something that happens with Emacs on some systems.
>From the Emacs PROBLEMS file:

================================================================

* Slow startup on Linux-based GNU systems.

People using systems based on the Linux kernel sometimes report that
startup takes 10 to 15 seconds longer than `usual'.

This is because Emacs looks up the host name when it starts.
Normally, this takes negligible time; the extra delay is due to
improper system configuration.  This problem can occur for both
networked and non-networked machines.

Here is how to fix the configuration.  It requires being root.

** Networked Case

First, make sure the files `/etc/hosts' and `/etc/host.conf' both
exist.  The first line in the `/etc/hosts' file should look like this
(replace HOSTNAME with your host name):

    127.0.0.1      HOSTNAME

Also make sure that the `/etc/host.conf' files contains the following
lines:

    order hosts, bind 
    multi on

Any changes, permanent and temporary, to the host name should be
indicated in the `/etc/hosts' file, since it acts a limited local
database of addresses and names (e.g., some SLIP connections
dynamically allocate ip addresses).

** Non-Networked Case

The solution described in the networked case applies here as well.
However, if you never intend to network your machine, you can use a
simpler solution: create an empty `/etc/host.conf' file.  The command
`touch /etc/host.conf' suffices to create the file.  The `/etc/hosts'
file is not necessary with this approach.



More information about the Python-list mailing list