DEV Community

Discussion on: Is your Kotlin compiler slow? Here's a potential fix

Collapse
 
martinhaeusler profile image
Martin Häusler

Important note: if you want to build with IntelliJ (via its integrated build chain, not via gradle) the option you have to use is hidden in the "File -> Settings" dialog.

Go to "File -> Settings -> Compiler" and on the page details (right panel) set the "Build process heap size (Mbytes)" to a higher value (defaulted to 700MB for me).

Collapse
 
guizmaii profile image
Jules Ivanic • Edited

Thanks for your comment! It really helped me!

But with my version of IntelliJ (2021.1.1) the setting was not in "File -> Settings -> Compiler" as you explained but was in (on a Mac):

"IntelliJ Idea (in the top bar) -> Preferences -> Build, Execution, Deployment -> Compiler"

There, on the left side of the "Compiler" screen, there's "Shared build process heap size (MBytes)" field that was by default set at "700", I changed to "8192" and it changed my life! 🥳

See screenshot: dev-to-uploads.s3.amazonaws.com/up...

Collapse
 
martinhaeusler profile image
Martin Häusler

Glad to help out! It's ridiculous in many ways. It's so hidden and seemingly insignificant, yet has a huge impact. It's unaffected by any gradle setting. It's also unaffected by the Xmx setting of IntelliJ itself. It's not documented prominently anywhere.

That being said, even with enough RAM, the kotlin compiler is unfortunately not among the fastest compilers out there.