Compilation time

Hello community,

It is obvious that integrating mbedOS as an arduino core is complex and heavy procedure but the compilation time i am getting is really high(~3min for a 287596 bytes sketch). I do not own a very old CPU (i5-4440, 3.1GHz) and i haven't noticed any similar compilation time in the past (e.g. with stm32, esp8266, esp32 cores).

So i was wondering if there is something i am doing wrong or anything i can do to improve that.

Many thanks

I have the same issue by a factor of 10 verses compiling for an Every.

Also notice this but only on the first ever compile for the board.

Not fully sure of the reason but suspect @Alexisicte hit part of it.

Also noticed subsequent compiles even for different sketches seem better after that. Again not 100% sure why that would be except if it needed to re-build a copy of the core on the initial run.

Am also quite sure the MBED doesn't help and that as new releases come down the pipe it will get better. It is after all a very new board.

Bob.

@tiboine @ETM

The failure result in your cases would be quite useful.

Please READ THIS POST as it will help you get the best out of the forum.

Right now yours are just a "ME TOO" but not so useful.

Bob.

One possibility might be if you're still using a spinning disk drive. There are a large number of small files involved with compilation which can cause spinning disks to bog down. If you upgrade your hard drive to an SSD you might see a huge improvement.

It is not the spinning disk. I moved my project to the SSD and the times where the same. I compiled multiple times. I watched the disk usage and it was very low. This is a tools issue.

Until now it was likely not necessary to keep object files. The libraries where small and could be compiled every time the sketch was compiled. Basically, the Arduino IDE does a full clean compile every time. With larger libraries this is no longer an effective strategy. Once the sketch is compiled, the IDE should tell the compiler only to compile the files that have changed.

Maybe this will be possible with the new IDE. The Arduino IDE developers should notice this as well when they test their new creation.

Klaus_K: Once the sketch is compiled, the IDE should tell the compiler only to compile the files that have changed.

The modern versions of the standard Arduino IDE already do this. The only exception is that the sketch code is recompiled every time, but all the other previously compiled files are cached and only recompiled if a file is modified or if you change the board selection in the IDE.

There have been some problems where certain 3rd party cores were misconfigured in a way that caused the caching to not work, but I wouldn't expect that from the official core. From a quick test, it looks to me as if the caching is working as expected when compiling for the Nano 33 BLE. If you turn on File > Preferences > Show verbose output during > Compilation and then check the contents of the console window after the compilation, you can see the location of the cached compiled files that are being used.

I agree that compilation is notably slow for this board, but I think the cause may be recompilation. Perhaps it's related to dependency resolution due to the huge number of files in the core added by mbed.

pert, you are right, when you watch the compilation process, whatever the compiler is doing at the following step is taking a lot of time. You can watch one line appear every few seconds.

Alternatives for ArduinoBLE.h: [ArduinoBLE@1.1.2] ResolveLibrary(ArduinoBLE.h) -> candidates: [ArduinoBLE@1.1.2]

Everything after that is quite fast, when you compile for the second time. And the previously compiled files are used indeed.

Compiling sketch...

Compiling libraries... Compiling library "ArduinoBLE" Using previously compiled file: ...