[Solved] Performance problems with Macbook Pro + intelliJ

My intelliJ has been working extremely slow in a 13” Macbook Pro. I started to believe that it was like that because it was just a dual core and that intelliJ requires a more powerful computer. But it was working so bad, that it was very strange.

Today I tried vertx in this computer and I have noticed that each time I tried to run something it took a lot of time. Not just compiling, but also starting the server itself.

So I have stopped execution while waiting it to startup and I have noticed that it was waiting at InetAddressImpl#lookupAllHostAddr.

Searching in the Internet, I have come with this:

http://www.markhneedham.com/blog/2015/03/29/inetaddressimpllookupallhostaddr-slowhangs/

It says that it is trying to resolve the computer’s host and because the hostname is not registered inside /etc/hosts, it takes several seconds instead of a few milliseconds.

In order to find out our machine’s hostname, we can open a terminal and write down hostname, in my case:

: hostname
MacBook-Pro-de-Carlos.local

After that I have edited the file /etc/hosts and I have linked it to 127.0.0.1 and ::1 like this:

sudo nano /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
127.0.0.1       MacBook-Pro-de-Carlos.local
::1             MacBook-Pro-de-Carlos.local

The results? Vertx now starts much faster. But not just that. intelliJ itself works much faster. Compilation times has greatly decreased. And the computer runs snappier too. I have the feeling that the whole system was wasting time with this in every part of the system.