Insane upload time for ESP32 Devkit 1

I know this has been brought up before, but why does it take SO long to upload the first version of code to an ESP32 Devkit (or indeed, any ESP32)?

Timed it this morning (with firewall and anti-virus off). 12 minutes. That is insane.
Is there any way to improve this?

I tried PlatformIO and it just seemed very difficult to use and too complicated for Captain hobby here.

I've used lots of ESP32 DevKits, and never once seen that. The yALL program in something like 15-20 seconds with a large program (~400Kb).

After the first compile, the following ones are faster - about 1 minute.
It just seems a bit excessive

How old is your PC/laptop, and what OS are you using. First run on my fairly high-end Win11 PC takes about 50 seconds, with Windows anti-malware sucking most of the CPU power. Bit long, but the next run is a lot shorter (13 sec).
Leo..

Posh 3k Asus laptop running Windows 10.

IDE is version 1.8.19. I have stuck with this version as later versions just seem to mess up half my projects. This one works fine.

This long initial upload thing just means I end up leaving the computer on all day, so that I don't have to keep doing that initial long upload.

It's not the upload that's taking the time. It's compiling the sketch and associated libraries and ESP32 core. After the first time, only any code that has changed needs to be recompiled, so it's faster.

My tips would be:

  1. Use a CPU with a fast single-core benchmark. Not sure how much the compiler/IDE can take advantage of multi cores.
  2. Use an SSD, not an HDD. Doesn't need to be NVME, I suspect the IDE won't get much benefit from that versus a SATA SSD.
  3. Use a linux-based OS like Ubuntu, rather than Windoze.
1 Like

It's already an SSD.
Its a small thing... I should be patient. But, you sit down and think 'oh, I'll just tinker with that code while I have 15 minutes'..... and then you compile for the first time.

Much as I hate Windoze, I have too many other programs that require it to jump over to Linux.

12 minutes seems excessive. I just tried a ~700 line program and it took 1 min 10 sec for the first compile and ~10 sec after that. This is with Ubuntu, but I wouldn't expect Windows to be 10 times worse.

Try running the performance monitor during the compile and see if there is anything unexpected happening. On my system I was a little surprised to see multiple cores going to 50-100% usage. Apparently they do some parallel processing (on Linux at least).

Trouble is, this is a graphics intensive program. So I am adjusting the graphics and then re-uploading to see the effects and what needs altering.
The 1.5 - 2 minute upload time (after the initial long compile) is making this all a very painful, long process.
ESP32's are going to the bottom of my go-to pile after this.

You have mentioned upload time more than once. As a matter of interest what have you got the upload speed set to in the IDE ?

'cause may you never try it. Windows is painful slow to compile Arduino code, at work i have a laptop with an Intel I7 ,16Gb of RAM and Win10, and a simple Raspberry PI4 is faster than it , at least by double.

Ciao, Ale.

Upload speed.... 921600 (the highest).

@PaulRB Is correct. It will also change with how much you use of the libraries etc as it does not compile unused code (optimization) but it has to check for that. I run a Linux system, have been for many years and this was definitely noticeable. It will load up all 8 cores on my system when compiling, not sure which is just compiler. In Linux it appears the more cores the faster the compile.

Also still using 1.8.19

Post#4. Few hundred lines is less than 50 sec on Win11 Pro, which I run very lean.

The IDE uses zero graphics in my compile.

Windows has tools to see what is slowing things down, like "Taskmanager".
Leo..

OK, I went to my dual boot machine and tried my ~700 line program there.
Intel I3-10100
16MB
SSD

Windows 11 3 min 33 sec first compile, 43 sec for second

Ubuntu 22.04 51 sec first compile, 10 sec for second.

It does appear that Windows sucks more than I thought. In both cases performance monitor shows multiple cores were used.

I have a notebook Win10 with I7 6th, 8Gb RAM, SSD256Gb and it never takes more than 1 minute (maybe 1.5) to compile code for ESP32.
One thing is how long it takes and another how anxious the wait makes us. :wink:

These results seem to indicate that the biggest part of the problem is the compilation of the core and libraries. Arduino IDE caches the compilation output and then reuses that cache during subsequent compilations for that board.

Maybe it would be worth seeing if we can find the solution to the problems you had with Arduino IDE 2.x.

The reason I suggest this is because Arduino IDE 1.x clears the compilation cache when you exit the IDE. This means that you have to suffer through that extra 11 minutes to compile the core and libraries at the start of each IDE session. Arduino IDE 2.x does not clear the cache, which means that you only need to wait for it to be generated once, after which it can be reused over and over again across IDE sessions until such time as the cache might be invalidated when you update the dependency (the IDE is smart enough to know when it needs to recompile), or if your system temporary folder was cleared through some external process (e.g., using the Windows feature to free up disk space).

Although I accept that some people have valid reasons for preferring to continue to use Arduino IDE 1.x, I don't think "it messes up my projects" is one of them. I can't think of any reason why you wouldn't be able to easily get your projects working with Arduino IDE 2.x just the same as they do with 1.x.

I have upgraded many times to different versions of the IDE and always ended up going back.
I just seem to have issues with it loading code onto projects that work fine in the 1.8.19 version, but fail when I get into the 2> IDE's.
It's usually projects that involve touchscreens etc.

Don't ask me why.... I have no idea

Just first complied again this morning, 10 minutes, 20 seconds.

Well tried a later version IDE and it actually made the first compile take 13 minutes! :roll_eyes:

I can't work it out. But, I can't spent half my evening waiting for uploads. It's just eating up my time.
Now literally any change takes 3 or 4 minutes to upload. If you have a compile error, it can take forever before it bails and throws up the IDE error.

I have abandoned ESP32's entirely.

Added a WiFi chip to a Teensy 4.1. Going to try that instead. Bit overkill on the processor size, but hey ho.

Was that only for the first compilation, or was it every compilation? If it was only the first compilation then keep in mind that needing to do a full compilation is relatively rare when using Arduino IDE 2.x. You would typically only experience it when compiling the first time for a given board, or after updating a boards platform. Since we tend to use a small set of boards, and since the "esp32" platform release cycle period is usually on the order of months, that doesn't happen very often.

Nice!