20 minutes compilation time for ESP32

I am seeing 20 minutes compilation times for ESP32 boards. I use ESP32 WiFi.

What gives?

Is your PC in a work or school or home environment?

I have also experienced very slow compilation.

It really helps if you shut down firewall/virus scanner for the IDE…

Home, no antivirus.

the good news: the second time goes faster (due to use of cached files).

1 Like

Try turning off verbose

5 minutes for a simple code change.

Verbose where?

Preferences, turn off verbose compile it is surprising how much that slows it down.

Where is the code, post it so we can time it and see if it is just you or everyone.

Is that a Windows PC ?
What are the performance parameters, for example, this is mine with Windows 11 Pro:

If you are using the Windows encrypting file system you may have performance problems if temporary working files/directories are encrypted.

I see the difference between first and subsequent compiles, the cached files etc. When compiling on a network drive it slows down a lot. These are wired network connections that operate over 100Mbps. I would have a hard time imaging how slow it would be over WiFi.

Try switching to a faster router. This I just found on the internet:

https://www.howtogeek.com/217463/wi-fi-vs.-ethernet-how-much-better-is-a-wired-connection/

It is important to understand that the maximum speed listed for Wi-Fi networks is the maximum bandwidth for all devices on the network, not an individual connection.

1 Like

Good point! Even worse if it is say a Google Drive, One Drive or some other remote network file system is involved.

As promised: much faster… Still annoying though…

1 Like

Sorry, I cant post the code, but it has WiFi, credential manager, MQTT, Firebase, LoRa library, 3x temperature sensor, comm debug uart and the application itself.

I am down to 3 and a half minutes recompile with no modifications to code.

Win 10 machine, this feature was removed, but there is still a way to check, here is my score:

MemoryScore: 8.9
CpuScore: 8.9
CPUSubAggScore: 7.9
VideoEncodeScore: 9.9


Sorry, I was ambiguous. I use ESP32 WiFi.

Back to 20 minutes after a change in code. Unusable.

Having eliminated the usual suspects

  • antivirus
  • network/remote drive (e.g. OneDrive)
  • encryption

Contrary to a previous suggestion, turn on Verbose compiling, and pay attention to what it says. (You can do a Copy All on the Output and search in an editor to more easily see how it's laid out.) Here are the timings for a 4-minute clean compile and immediate re-compile of a moderately complex ESP32 sketch.

clean cache
[initial] 2.880 6.045
detecting libraries 133.938 19.014
function prototypes 2.689 2.689
compiling sketch 12.976 3.189
compiling libraries 62.677 0.397
compiling core 17.925 3.759
linking 6.933 6.804
[final] 1.245 1.153
---------------- ----------------
Total 241.265 43.05

"Detecting libraries used" takes about half the time. (This is an older run; there should be some improvement as of a few versions ago.) In any case, it may help to see if it is just slower overall, or if there are one or two parts that are abnormally slow. Since you probably don't have an instrumented back-end that prints times like this, use a stopwatch, like on your phone. If the whole thing takes 20 minutes, it doesn't have to be that accurate.

BTW, this was on a dual-boot. With Linux instead of Windows, it took 73 and 14 seconds.