Will dual Xeons improve Android Studio build times?

7

2

I am an Android developer and spend a lot of my time waiting, so I have started considering a a dual Xeon setup.

I know that, for example, for a 3D rendering solution - the additional cores improve the speed pretty much linearly, so my question is - will Android Studio build times decrease the same? And if not linearly then at least noticeably to make the upgrade worthwhile?

I know AS has multicore support, but just wanted to make sure it will use all 20 cores the same as it does 4 before I go out and spend the money.

Would be great to hear from someone with experience comparing dual Xeons to i7 setups for same project builds, but any info will help!

-

PLEASE NOTE:

Before you recommend to look at other ways to improve speed - let me assure you that I have tried about everything - fast SSD, plenty of RAM, all the possible Gradle and IDE options, abstracted some dependencies to build for release builds only to avoid multidex, latest AS version, Instant run / JRebel etc.

Alexandre G

Posted 2016-08-18T23:19:32.150

Reputation: 361

It will use all the real cores nicely. Once you're pushing it hard the virtual HT cores won't give much practical gain. One thing you can try is make a VM that is allowed a CPU count equal to the real core count. That will allow heavy usage yet still allow you to do other things outside the VM as the compile progresses. [Based on empirical observation using 2 6-core Xeons & autobuild/cmake/Xcode in & out of Parallels VM] – Tetsujin – 2016-08-19T08:56:51.907

Answers

16

So I had to find this out the hard way. In my case, with my project and hardware it did not use all the cores. I've done some basic benchmarks with different hardware I had, but take them with a grain of salt - you should understand that requirements and setups can affect outcome tremendously.

Testing details

So this is the hardware I had:

  • i7 6700k (4 cores)
  • i7 3770k (4 cores)
  • 2 x Xeon E2650 v4's (24 cores)

All running at base clock with hyperthreading. And the SSDs:

  • Samsung 840 EVO Basic SSD 240GB
  • Mushkin ECO2 SSD 240GB
  • Samsung SM951 NVMe SSD 250GB

Each drive had Windows 10 installed, so I've tried to test two things - processor speed and drive speed by swapping drives between computers.

Xeons and 6700k had DDR4 Ram and 3770k had DDR3.

Read graph from bottom up:

enter image description here

So the process, which wasn't very scientific, involved repeating tasks a few times and then taking the average of those.

Rebuild after clean: Build -> Clean project, Build -> Rebuild project

Rebuild: Build -> Rebuild Project

Launch when built: Launch and note gradle time upon first launch after rebuild

Launch again: Keep launching without changes to warm gradle daemon

Change one log: Change string inside Java's Log.v and rebuild

With install no change: Time taken from pressing run button to opening on screen

Simulator launch time: Above time minus Gradle build time

The conclusions for me were that:

  1. Faster SSD's do shave off seconds
  2. For now one should stick with fastest single core CPU's

Hope it helps someone!

P.S tried benchmarking Xcode builds on same hardware - pretty much the same story

Alexandre G

Posted 2016-08-18T23:19:32.150

Reputation: 361

1How big was your project? How many classes/methods do you have? How many libraries do you pull in? What's the structure (lot of small modules, monolyth)? How many modules were rebuilt? Is parallel execution enabled? How much memory did Gradle get from the system? – TWiStErRob – 2018-05-09T18:56:55.443

2

There is one more option to increase build speed: when you make your app modular, it will build asynchronously, so each module will take it's core of CPU.

And one more thing. Mind your libraries. For example in most cases you don't need the whole google support library, exclude unused parts, or import only needed.

And one more thing. I do not know how the OS influences the build speed, but I think it somehow does. When I use Linux vs Windows, it is much faster to build the project.

Віталій Шимко

Posted 2016-08-18T23:19:32.150

Reputation: 21

Thanks. Just found a good article about modules: https://medium.freecodecamp.org/how-modularisation-affects-build-time-of-an-android-application-43a984ce9968 Will try Linux as well! Re libraries, I even abstract some away for debug builds.. Analytics, Bug tracking, Google stuff not often needed etc

– Alexandre G – 2017-09-03T09:37:05.683

1I can confirm that in general build times are on linux/macos are 10-20% faster than on Windows (I tested it on the same hardware) – Igor Wojda – 2018-05-22T20:22:45.900

2

I have tried to measure speed of Android Studio 3.1.4 on the same hardware: Macbook Pro 2011, RAM 4Gb, SSD 240GB Samsung, Core i5 2.4Ghz. I have installed on this machine 3 different OS: Windows 10, MacOS Hight Sierra 10.13, Ubuntu 18.04. Avarage build time (running command: gradlew clean build, gradlew clean assembleRelease) on MacOS/Ubuntu was around 30% faster than on Windows.

On my another working machine: Core i5 3.0 Ghz 7400, RAM 16Gb, SSD 250Gb. Build time takes 4.34min on Windows 10 machine. The same project on a little bit slower processor, but with the same RAM and SSD and it is running Ubuntu 16.04 build time takes two times faster!! Well I was shocked with results, but still I choose Windows as development machine, because it's much more comfortable for me to use comfortable and usable keyboard and sotfware than on Unix like systems. And even if I had to choose between MacOS and Ubuntu - mac is really much easier to setup everything, and Ubuntu is too complex to use for usual people. Choise is up to you.

yozhik

Posted 2016-08-18T23:19:32.150

Reputation: 135