Friday 1 March 2013

Reducing Windows' background CPU load while building Firefox

If you're building Firefox on Windows 8 like I am you might want to tweak the following settings to reduce the OS' background CPU load while you're building Firefox (some of these settings may also be applicable to Windows 7, but I haven't test this):
  1. Add your src/object directory to Windows Defender's list of locations excluded from real time scans. I realized that the "Antimalware Service Executable" was using up to 40% CPU utilization during builds before I did this. You can add your src/objdir to the exclude list using the UI at: Windows Defender > Settings > Excluded files and locations.
  2. Remove your src/objdir from Windows' list of locations to be indexed. I actually did the inverse, and removed my home directory (which my src/objdir was inside) from the list of indexable locations and re-added the specific subdirectories in my home dir that I wanted indexed (Documents, etc) without re-adding my src/objdir.
Update, 11 July 2014: Recently the "Antimalware Service Execuable" started hogging CPU again while building, so I added MSVC's cl.exe, and link.exe, to the list of "Excluded Processes" in Windows Defender > Settings, and that reduced "Antimalware Service Execuable"'s CPU usage while building.


Mark Hammond said...

Nice tips! But I go one step further - I exclude my entire "\src" directory from security essentials, and disable the "Windows Search" service entirely seeing I never actually use it!

Unknown said...

Readers of this post will appreciate that mach will soon grow the ability to detect slow builds due to high background process activity.

wgianopoulos said...

Really great tips!

I had already been excluding these areas form AV scans. I also run VMware Server on this machine and exclude the directory where the Guest OSes live.

However, I had completely missed the indexing as being an issue. Excluding my build src and objdirs form indexing reduced the build time of a full source clobber by a whopping 1 hour! ;-)

Neil Rashbrook said...

A/V and/or search can also cause problems during configure, I see there are six bugs filed in Bugzilla which may be related.