Compile times and build all

I am confused to understand how the compile system works.
using a simple blink example.
When I select verify/compile my sketch starts to compile.
However it takes over 26 minutes to compile, I would expect this to be much shorter than this.
If I then repeat the verify/compile the compilation starts again but this time compilation is complete in around 6 minutes.
I am assuming the first tiime all files are compiled while in the second time some of the object files are not compiled again and the precompiled files use the oblect files in the linker.
I cannot get any consistency in whether Ithe long compile or short compile will be the selected one.
Would you expect the copile time to be as long as I am seeig
I am using the new "Arduino NANO P2040 connect" board

That's correct. The libraries and core are cached on the first compilation, so they will only be recompiled if you change the board, restart the IDE, or modify the files. The sketch is recompiled ever time, but that is not usually very much code, so the subsequent compilations are much faster.

Definitely not. The compilations do take longer for the boards of the Mbed OS boards platforms because there is a lot of code for the RTOS. But nothing even close to what you're describing.

A common cause of slow compilation is your antivirus software doing an on-access scan. The Arduino IDE creates a ton of short processes during the compilation, so if each of these has to wait to be scanned before running, it slows things way down.

Try TEMPORARILY disabling your antivirus for a single compilation to see if you notice that it makes it significantly faster, then turn the antivirus back on. If the compilation is faster with the antivirus off you will need to adjust the settings of your antivirus to put the appropriate file, folder, or process on the antivirus software's "allow list" so it doesn't interfere with compilation.

Please be cautious about working without an antivirus. 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 antivirus "allow list" for the Arduino software.

Another tip is that you should make sure you are using the "Arduino Mbed OS Nano Boards" platform, rather than the "Arduino Mbed OS Boards". The reason is that the deprecated "Arduino Mbed OS Boards" platform contains code for all the significantly different Arduino boards that use Mbed OS (Nano 33 BLE, Portenta H7, RP2040) and this slows down the compilation. The platform was recently split up into separate platforms for each distinct family of boards to make things faster, but the old platform is still available for installation via Boards Manager so some people might still be using it.

1 Like

What operating system is it and what processor is it using? Is anything else taking longer? In some computers when the CPU gets hot the clock is slowed down. A bad fan could cause what you are seeing.

I assme I would iclude the IDE .exe file in the allow list, what other file folder should I allow.

OS Nam:e Microsoft Windows 10 Pro

Processor: Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz, 2201 Mhz, 2 Core(s), 4 Logical Processor(s)

I will take a SWAG and say the fan is running and that is about correct. I am assuming it is not a SSD on the system. I would also guess you have a virus checker running and a few other processes. Is the mail system operating? Sorry I cannot offer any more.

I have snozed my main virus checker, Total Defense, there is no reduction in compile time.
What files/folders should be added to the allow list.

Any other suggesions?

What does task manager have to say about CPU utilization?

Are any of the folders the Arduino IDE uses hosted on network drives or managed by cloud storage services (e.g., OneDrive, Dropbox)?

You can try running the Arduino IDE in portable mode to limit the spread of the folders it must have access to (it will be limited to the installation folder and the system temporary folder once in portable mode):

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.