Seiten

Tuesday, February 2, 2021

MacBook Pro M1 2020 Java performance with Rosetta emulation

Intro

I just bought a shiny new MacBook Pro M1. And had to send it back.

But why?

Well. I am using Macs for the last 18 years. And I also participated in the transition from PowerPCs to Intels. I am primarly a Java dev. Back then it was working for me. The Intels were just so much faster than the PowerPCs (which were really slow).

Now? There's not yet a dedicated Java SDK available (ok - azure got a working one, but there is no official one from openjdk for instance).

So Rosetta provides an emulation to run any x86 app on the arm platform.

The good news: Rosetta's emulation is working nicely. All sorts of brew installed applications work. Java works. Maven works. Netbeans works. All good.

The bad news: When developing software I had the feeling that the M1 Mac is a lot slower than my 3 year old Macbook Pro i7.

Feeling? Well... let's run some tests and check the numbers.

Performance test

Specs for the tests

  • AdoptOpenJdk 11.0.9.1 (x86)
  • Maven 3.6.3
  • MacBook Pro i7 2018 2.7 GHz 16GB versus Macbook Pro 2020 M1 16GB.
  • Compilation of Ninja - an open source Java framework (https://www.ninjaframework.org/)

Compiling ninja-core (a smaller part of the ninja framework)

  • 2020 MacBook Pro M1: building ninja-core mvn clean verify 31 seconds
  • 2018 MacBook Pro i7: building ninja-core mvn clean verify 13 seconds
Ouch. i7 is 2.3x faster than the (Rosetta) M1.

Compiling ninja (the whole framework)

  • 2020 MacBook Pro M1: building ninja-core mvn clean verify 188 seconds
  • 2018 MacBook Pro i7: building ninja-core mvn clean verify 115 seconds

Ouch. i7 is 1.6x faster than the (Rosetta) M1.

Notes:

  • This is of course a bit unfair for the M1 Mac because it has to run everything in emulation. But this is the whole point of this article
  • These are not super-scientific numbers, but I ran the compliations multiple times and the numbers were roughly the same.
I would have expected the new Mac to be as fast in emulation as the 3 year old i7. But that is not the case. It is a lot slower. Thus my current Java workflows are massively impacted by the slow emulation of the x86 Java editions.

Conclusion

What does this mean?

Not much. I am sure the performance will increase substantially once the apps (and especially the java apps) are running natively on the M1 Macs. And of course this is not really a fair comparison. Running something in emulation will be slower.

But for me this is too slow. So I personally cannot use the M1 for productive work. Sad.

More - Some screenshots with specs and numbers

Macbook Pro i7 2018

Macbook Pro M1 2020