Solution
The issue that is Windows Defender's Real-time protection is blocking an application from being able to read a file until it has read the file. It should, of course, be scanning in parallel - not synchronously delaying file access.
Fortunately, Windows Defender has the capability to skip synchronous checking of files based on a file extension - called Exclusions:
What you can do is under Windows Defender, click Add an exclusion. Under File Types, click Exclude a file extension. Individually add the extensions:
- pas - Delphi Source File
- dfm - Delphi Form
- dpr - Delphi Project
- dproj - Delphi Project File
- dcu - DCU file
- cs - C# source file
- txt - Text File
- pst - Outlook mailbox
- docx - Word document
- xlsx - Excel spreadsheet
- gif - Graphics Interface Format image
- jpg - Joint Photographic Experts Group image
- bmp - Bitmap
- res - Compiled resource
- bpl - Borland Package Library (a dll with a different extension)
- dll - Dynamiclly Linked Library
- exe - Application
- com - Application
- bat - Batch File
- cmd - Command file
- scr - Screen saver
- cpl - Control Panel Applet
- et cetera
This way you get all the security of real-time protection, with the blazing speed of unimpeded native file access performance.
This change improved my build times:
- Before: 86.2 s
- After: 4.7 s
A 94.5% improvement!