Hi @hamokhalil. When people report exceptionally slow compilations, we often find that it was caused by security/antivirus software on the user's computer. Arduino IDE creates a large number of short duration processes during the compilation. Some antiviruses do "real-time"/"on access" scanning of processes. The process is blocked until the scan is completed. The added time for each scan is quite significant in relation to the duration of the process, so the total impact of the many scans is a great increase in the length of the compilation.
As an experiment, you can try
TEMPORARILY
disabling the security software/antivirus on your computer for a single compilation to see if the problem goes away:
- Disable the security software/antivirus software.
- Compile the sketch, just as you did before.
- Wait for the compilation to finish.
- Immediately enable the security software/antivirus software again.
If the problem doesn't occur when you tried a compilation while the security software was disabled, you will need to adjust the settings of your antivirus to put the appropriate file, folder, or process on the "allowlist" so it doesn't interfere with compilation.
Please be cautious about working with the security software disabled. This is only about temporarily disabling it for a quick test. If you don't feel comfortable doing that, fine. You can try going straight to configuring the security software so that it does not interfere with the Arduino software.
ⓘ Arduino IDE does caching during compilation, so subsequent compilations will be faster than the first one. So take care to avoid that unrelated difference throw off your results when you are comparing compilation times.