Chris Horner

Blog

Windows vs Linux Android Build Time

6 September 2020


After recently comparing build times by CPU, some pointed out that build times might be greatly affected by the operating system. I was curious about this, and decided it was time for another benchmarking adventure.

Ideally we’d compare Linux, Windows, and macOS on identical hardware. I considered using my 2018 Macbook and running Bootcamp for Windows, but unfortunately it looks like Apple’s thermal throttling “fix” only applies when running macOS, which wouldn’t make for a fair fight.

Instead, I decided to directly compare just Linux and Windows using the Ryzen 3950X. I could have taken this a step further and made a hackintosh, but that much effort might be an exercise for another time.

Not wanting to mess with my existing Windows installation, I removed my current SSD and replaced it with a spare Kingston PCIe Gen 2.0 x4 M.2 SSD. Not the fastest by today’s standards, but hopefully fast enough. I first installed Linux, then Windows onto the exact same disk when performing the tests.

For projects, I decided to again use Tivi and Socket Weather as representatives of large and small codebases respectively. Like the previous post, the apps were built at the commits:

Tweaking Windows 10 Professional

One important step I’ve always taken is to ensure that Windows Defender isn’t relentlessly scanning files during a build. A quick search reveals this is a common problem, but adding appropriate exclusion directories should help alleviate the issue.

Which Linux Distro?

I decided to install Pop!_OS, an Ubuntu derivative that advertises itself as:

an operating system for STEM and creative professionals who use their computer as a tool to discover and create

I’d also heard it was easy to install with Nvidia drivers out of the box. Great for me who wanted to spend as little time configuring the OS as possible.

Methodology

After my previous round of tests, I’ve since learnt I could have automated much of my testing with gradle-profiler. In the future I’ll definitely be using this tool, but in order to keep the data from this round of testing comparable to the previous round, I decided to follow the same process outlined in the previous post.

Results

Let’s start with the median time of a full Socket Weather build.

Whoa! Linux takes roughly one third the time of Windows with a gain of 67%. What about for incremental builds?

Not quite as big a difference at 32% faster, but still significant.


Let’s move onto the heftier Tivi, a project more representative of what developers might be working on day to day.

Here we see Linux building 16% faster than Windows. Not quite as impressive as Socket Weather, but a seven second gain isn’t bad.

For an incremental build, Linux was just shy of being two seconds faster; an increase of roughly 21%.

Conclusions

It certainly looks like the crown goes to the penguin on this one. This was a genuine surprise to me. I’d always figured after taming Windows Defender, Microsoft’s OS wouldn’t impose significant penalties compared to other operating systems.

What’s the cause of the difference? I find this a difficult question to answer.

Maybe it’s related to the filesystem? Windows uses NTFS, while the distribution used for these benchmarks uses EXT4.

Perhaps there’s configuration in Windows Defender that I missed? If anyone else has done similar tests, please get in touch!

Does this make Linux a better choice? Maybe. It depends on your workflow. It certainly seems to offer faster build times on the same hardware. It also integrates nicely with many existing development tools thanks to being another *nix environment.

However there’s also software it can’t run. (The lack of Affinity Designer is a deal breaker for me). There’s also hardware compatibility to consider. It’s neat that you can recompile your kernel to add support for things, but not something I necessarily want to do 😅.


Thanks for following along with this little series. I might do more in the future that compares build times by RAM and disk speed, but I’ll wrap this up for now. Again, if anyone has any suggestions or ideas for fairer and more accurate tests, I always appreciate the feedback.

— Chris Horner