Slow startup?
Jo Vermeulen
jo at lumumba.luc.ac.be
Thu Apr 14 23:03:53 BST 2005
Op 14-apr-05 om 20:51 heeft Simon Ekstrand het volgende geschreven:
> Jo Vermeulen <jo at lumumba.luc.ac.be> writes:
>> Eliminating these calls (socket.getfqdn), but still including all the
>> extra printing I did cuts off 2 whole seconds!
>>
>> $ bzr
>> real 0m0.557s
>> user 0m0.310s
>> sys 0m0.120s
>
> Can you manually resolve (with 'host' or similar) the output of
> 'python -c "import socket; print socket.gethostname()"' ?
> Is the time it takes similar to the two seconds noted above?
Sorry, I don't quite understand what you want me to do.
> socket.getfqdn makes a gethostbyaddr call which is probably what's
> taking
> time. It should however be very fast if your own hostname is included
> in
> /etc/hosts, which is generally the case.
Aha :-) I added my hostname to the /etc/hosts file (which Mac OS X
doesn't do by default), and this is the outcome:
$ time bzr
usage: bzr COMMAND
try "bzr help"
real 0m0.447s
user 0m0.280s
sys 0m0.110s
And the test scripts:
$ time python hostname.py
real 0m0.110s
user 0m0.050s
sys 0m0.030s
$ time python fqdn.py
real 0m0.105s
user 0m0.040s
sys 0m0.040s
So it's fixed indeed! Thanks! Would be nice if Python looked in the
config file Apple stores the hostname too though, because by default
it's not in /etc/hosts. Don't know where it actually is stored :-)
Kind regards,
--
Jo Vermeulen <jo at lumumba.luc.ac.be>
http://lumumba.luc.ac.be/jo/
More information about the bazaar
mailing list