" />

" />

[Solved] Performance problems with Macbook Pro + intelliJ

Problemas de rendimiento Macbook Pro + intelliJ

07 Nov 2016

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.


IntelliJ me estaba funcionando extremadamente lento en un Macbook Pro de 13 pulgadas. Llevaba tiempo pensando que era debido a que era un portátil dual core y que intelliJ necesitaba un ordenador más potente. Pero estaba funcionando tan extremadamente lento que ya no era normal.

Y hoy probando vertx en este ordenador he visto que en cada prueba tardaba mucho en arrancar. No solo en compilar, sino en arrancar el servidor. Así que he parado la ejecución mientras esperaba el arranque y he visto que estaba parado en InetAddressImpl#lookupAllHostAddr.

Buscando en Internet, he llegado a esta dirección: http://www.markhneedham.com/blog/2015/03/29/inetaddressimpllookupallhostaddr-slowhangs/

Básicamente dice que intenta resolver el host del ordenador y que como el hostname no está registrado en /etc/hosts se tira varios segundos en vez de milisegundos.

Para averiguar el hostname de nuestra máquina, basta con abrir una terminal y escribir hostname, en mi caso:

: hostname
MacBook-Pro-de-Carlos.local

Y luego he editado el archivo /etc/hosts y he vinculado el hostname a 127.0.0.1 y a ::1:

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

¿El resultado? Vertx me arrancaba mucho más rápido. Pero no solo eso. intelliJ completamente funciona mucho más rápido. Los tiempos de compilación han bajado drásticamente. Y el ordenador en general me va mejor. Me da la sensación de que esos segundos de espera se estaban propagando por todo el sistema operativo.

Ojalá le ayude a alguien más.