How I reduced build time 7 times on Windows 10 dev PC

I am on Windows 10 Home PC (SSD) and I remembered that 2 years ago project build time was around 30 sec with --parallel.

I noticed that today everything-update build takes 3.5 min (without --parallel)!

Development cycle edit-build-test becomes cumbersome.

I dig into issues and most helpful was Temporary folder (/tmp) filled up with gradle_uploadXXXSHA1 files

So I disabled 8.3 file name support (elevated shell required, search for “cmd” in Start menu and hit Ctrl+Shift+Enter to get one):

fsutil.exe behavior query disable8dot3
fsutil.exe behavior set disable8dot3 1

This improved build time by 7%. I already had disable access time on NTFS:

fsutil.exe behavior query disable8dot3

you can disable via one of:

fsutil.exe behavior set disableLastAccess 1
fsutil.exe behavior set disableLastAccess 3

Next BIG thing is Windows Defender. Old tips to use procmon with MsMpEng.exe process name shown nothing. But MsMpEng.exe constantly takes 5-7% CPU and 300-500 KB/s IO during build.

The most important thing to consider is how Antivirus works. It injected itself into process address space and listen to OS events and inject itself into driver filters. So antivirus is invisible from Procmon!!

I collected paths that contains gradle from procmon and added base directories as exclude directories:

c:/home/devel (my project base dir)
c:/home/.gradle (my GRADLE_HOME)

One note. Gradle intensively uses TMP directory. I don’t want to exclude this directory from protection. So I added:


This dropped build time 6 times (from more than 3 min to 30 sec).

I still saw 150KB/s IO. Remember that Antivirus injects itself into process! In my case it is java.exe which is also added for exclusion to Defender. This gives 0.1-0.2% CPU load and zero IO in Defender process!!!

Final result:

gradle --stop
gradle testCompile   # cold start
gradle testCompile   # hot start, everything is UPDATED (before investigation was 3m 47s)

Next thing is to fight lots of deferred dependency resolutions that block actual fast re-compilation and resource processing.


I also excluded everything from Windows Search Indexing, forgot to mention as it was done year ago ))

If anyone hates GUI run in elevated cmd:

powershell -Command Add-MpPreference -ExclusionPath "C:\tmp"
powershell -Command Add-MpPreference -ExclusionProcess "java.exe"
powershell -Command Add-MpPreference -ExclusionExtension ".java"