Feb 27, 2013

Speeding up OpenOffice/LibreOffice

I had major problems with OpenOffice and its clone: LibreOffice. When I launched OpenOffice, it took about a minute for it to start. With LibreOffice the start was fast but opening each document took about 15 seconds of waiting.

I took OS X Activity Monitor and found that both apps spend all this time waiting in a call to gethostbyname. The call before that was a call to get the name of the local host. So both apps first tried to get the name of the local host and than to resolve its IP address and that did not work well.

I tried that the usual way:

$ nslookup Atlas

(Atlas is my computer's host name).

That worked perfectly fast. I scratched my head. Next I tried the closest, which I could find to a Java/C implementation:

$ php -r "echo gethostbyname('Atlas');"

There it went bad. It waited for those 15-20 seconds.

I checked my /etc/hosts. All fine:

127.0.0.1 localhost Atlas Atlas.local

Next, I started to think and remembered that recent OS X use IPv6 in many places where it does not make sense. I checked /etc/hosts again:

::1 localhost atlas atlas.local
fe80::1%lo0 localhost atlas atlas.local


Looks ok but let's change the first letter to uppercase, just to be consistent:

::1 localhost Atlas Atlas.local
fe80::1%lo0 localhost Atlas Atlas.local


Next I ran that PHP command again. Wow, it returned immediately! I tried with OpenOffice and LibreOffice. No delays anymore.

Funny, heh? Letter case makes such a big difference. And why would it try IPv6 if it is deactivated on my OS X?

No comments:

Post a Comment