• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Arduino 1.8.19 compile times

Q&A Forum › Category: Arduino › Arduino 1.8.19 compile times
0 Vote Up Vote Down
Joe Margevicius asked 2 years ago

HI, I may have asked about compile times in the past, but am still very bothered by how long they are with the Arduino 1.8.19 IDE.  So, I’d like to ask the audience for some benchmarking.

Here is the simplest code I can think of:

void setup() {
bool test = false;
}
void loop() {
}

I’ve run this just after startup, and it takes almost 2 minutes to compile (I just hit the compile button – not the compile/download).  When I turn off the wifi, and turn off ALL security apps, I get 36 seconds (but that’s probably because it’s doing some caching).  When I restart the IDE from fresh and all wifi and security on, I get 1 minute 12 seconds. I get the same results whether I use the “ESP32 dev module” or the “ESP32S3 dev module”.

How can a nonsense program like that take so long without wifi and security (I have a fast PC)?  (my serious programs can take 6-8 minutes with wifi and security on, and are driving me to serious multi-tasking).

What is your experience with this program?  Thanks!

12 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
That’s a very long time to compile. That never happened to me.
One program like that will take like 5 seconds to compile or less.
 
Where do you have your ARduino IDE installed? Do you have the ZIP installation?
Have you tried with a new installation?
Regards,
Sara

0 Vote Up Vote Down
Joe Margevicius answered 2 years ago

Hi Sara …. so I completely cleaned out my PC of anything to do with Arduino (i.e. in ProgramFiles(x86), in Users/xxx/Documents, in Users/xxxx/AppData/Local — no remnants of Arduino). Then I did a reinstall, adding the link for the Board Manager (i.e. https://dl.espressif.com/dl/package_esp32_index.json ) in Preferences. (my install is on the C: drive, and the programs are in the /Users/xxx/Documents/Arduino folder; no, I’m not using the zip installation – just the arduino-1.8.19-windows.exe file)
For the very same code listed above, here is what I get for compile only:
For board = Arduino Uno:
– restart IDE: takes 12 seconds to compile  (THAT’s A GREAT IMPROVEMENT OVER THE PREVIOUS RESULTS)
– change the constant w/o restart: takes 9 seconds
For board = ESP32S3 dev module:
– restart IDE: takes 1 minute 7 seconds
– re-run w/o changing anything: takes 36 seconds
(I tried removing the Board Manager link in preferences – no change)

These are very long compile times for a nonsense program, even when the board selected is Arduino Uno!  … when I do my “real” program (~800 lines of code), it takes over 6 minutes to compile !!!

Any ideas on what this could be due to?  Thanks for any help 🙂

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
Yes. That’s definitely a long compiling time.
Unfortunately, I don’t have any idea why that might be hapenning to you.
Sometimes, antivirus software may cause that.
Regards,
Sara

0 Vote Up Vote Down
Joe Margevicius answered 2 years ago

Hi Sara.  So I explored in more detail what is happening when that simple program is compiled after the IDE is just started, and also when complied due to a small change in the one and only constant.  I enable “Show verbose output during compilation” in the File/Preferences page.

This is a “busy” response, but I would love your help in either trying to reproduce the simple code with the ESP32S3 Dev Module “board” (which is what I use), or helping me find someone/blog who can explain this unusual behavior I’m experiencing. Here is what I experience on my “fresh install of Arduino 1.8.19” on my “wifi-disconnected”/ security disabled PC.

Arduino Uno “board” selected: Here is what happens when the compile button is hit:
1) arduino-builder is run with -dump-prefs and lots of other switches
2) arduino-builder is run again with -compile switch, and the same bunch of other switches
3) “Using board ‘uno’ from platform
4) “Using core ‘arduino’ from platform
~~~~~~~~~~~~ this much takes 15 seconds, both when the IDE is first started and the code compiled, and the constant in the cost is changed and recompiled~~~~~~~

~~~ the next section takes 5 seconds when the IDE is first started, but takes 2 seconds when just the constant is change & recompiled ~~~
5) Detecting libraries used
6) Generating function prototypes
7) Compiling sketch
8) Compiling libraries
9) Compiling Core
10) Linking everything together
…. total for this nonsense code: ~20 seconds initially, 17 seconds with small change

ESP32S3 Dev Module “Board” selected: Here is what happens when the compile button is hit:
1) – 4)  (same steps 1-4 as above), takes ~31 seconds when the IDE is first started code compiled, and when constant changed/recompiled
5), 6)  (same steps as 5-6 above), takes ~ 12-14 seconds when IDE first started the code compile, and when constant changed/recompiled
7) Compiling sketch – takes ~33 seconds when IDE first started the code compile, and ~6 seconds when code changed/recompiled
9), 10)  (same steops as 9-10 above), takes ~11-13 seconds both when IDE first started, and when code changed/recompiled
…. total for this nonsense code: ~1minute 30 seconds initially, ~48 seconds with small change

It is clear that something is wrong if others are experiencing significantly shorter times.  These results are the same whether I have WiFi and security on, or completely off. In the “compiling core” section, when the IDE is first turned on, it runs hundreds of includes (takes pages and pages during 33 seconds) and does irrelevant things like include/wpa_supplicant, include/esp_websocket, include/esp_led…. as nauseam !  When run a 2nd time, it uses “precompiled core” so it saves the 33 seconds, but both runs do all the rest of the 45+ seconds of stuff.

 

Again, if you could try to reproduce this for this simple circuit using ESP32S3 Dev Module board, I would really appreciate it; otherwise, do you have someone/some link to write to about this ?

 

Thanks !

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
What type of Arduino IDE installation do you have?
Is it the . ZIP install? Where is the folder located? Is it on the Desktop or located inside many other folders?
Do you happen to have the Arduino installed inside Google Drive folders?
 
I don’t know how I can reproduce that issue on my system because I’ve never have such long compilation times.
 
I also searched this issue on some forums, but the issues I’ve found are very outdated (like from 2017).
 
Alternatively, you can try using another IDE like VS Code (but it may take a little for you to get used to it).

  • https://randomnerdtutorials.com/vs-code-platformio-ide-esp32-esp8266-arduino/

 
Regards,
Sara

0 Vote Up Vote Down
Joe Margevicius answered 2 years ago

Hi Sara … I installed the IDE using arduino-1.8.19-windows.exe, which I downloaded (recently, again) from the Arduino website. The executables are in the usual place: Program Files (x86)/Arduino, and the program files are in the C drive at /Users/xxxx/documents/Arduino, which seems to be the default place for them (I usually don’t have them there, but with the re-install, decided to keep things simple).  I would still be interested in the time it takes for your system to compile the simple program using the ESP32S3 Dev Module – I need to have at least 1 data point of “proper operation” … thanks.  
 
I do prefer VS Code, but most of your tutorials are using the Arduino IDE, so that’s why I stuck with it.  It’s crazy that I can’t find any blog site to get help on this … oh well (I too found only outdated sites and un-helpful info).  Thanks for your help though 🙂
 

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
When I compile for the first time it takes 34 seconds.
Second time, it took 12 seconds.
I’m sorry that I can’t help much with this issue.
Regards,
Sara

0 Vote Up Vote Down
Joe Margevicius answered 2 years ago

Thanks Sara for you help – I appreciate it!  I did the same thing on a laptop, and though times were shorter, the 2nd time still comes in long at 38 seconds – your 12 seconds is more reasonable.  I am going to migrate to VSCode, but will try to understand the Arduino IDE issue, so if you don’t mind, can you leave this question open?  (my PC has an Intel i7 350Ghz, and the Laptop an Intel i5 333Ghz; performance testing (using PCMark 10) on these 2 show the PC being slower than tests by other people, but the laptop as expected … I’ll figure this out at some point!).

0 Vote Up Vote Down
Joe Margevicius answered 2 years ago

as an FYI — in VSCode/PlatformIO (using Arduino framework), the simple program takes 50-55 seconds 1st time, and ~20 seconds after changing the constant and recompiling.  (the good news is that the complex program, which before took ~6 minutes, now takes ~1 1/2 minute 1st time, and ~30 seconds with a recompile … significant improvement using VSCode over Arduino IDE !!!  
 
I’m not going to waste anymore time with the Arduino IDE, so you can close this question.
 
By the way, a project is “more portable” in VSCode if you manually install the libraries, versus using the “Transfer Arduino Project” found in the PlaformIO home (and mentioned in one of the blogs) – this latter process links to stuff in the C:/Users/documents/Arduino/libraries folder; manual install puts them in the project location without any links)

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
Thanks for the follow-up.
I always recommend creating the project from scratch in VS Code and installing the libraries so that you don’t have compaitbility and library issues.
 
I’ll mark this issue as resolved for now. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

0 Vote Up Vote Down
Alan Mainwaring answered 2 years ago

This is a fascinating issue I wish I could help with this. I wonder if there is an initial compile time that stays at say around the 2min mark, but then it may not change that much for say a program with say 800 lines. That is the 800 line program, would take say 2 mins and 10 secs.
I have been trying to use the so called AI sites like ChatGPT and it is interesting they seem to do OK on Fuzzy non technical issues nearly every time I have asked a deep question on a technical question you can see it has no curiosity or understanding.. This AI stuff is overhyped. Anyway this is a fascinating problem

0 Vote Up Vote Down
Joe Margevicius answered 1 year ago

Yes, it’s an interesting issue.  Creating an image using compiled code (C or C++), requires first compiling it, pulling in all the includes, then uploading it.  As far as I can tell, Arduino IDE does not save the results of a compile and every time a compile is requested, even on the same code, it starts over again (at least that is my experience, watching the compiling happen).  With VSCode, that is not the case – in the file structure is the compiled stuff, and a recompile takes a very short time.  I’ve switched to VSCode for all ESP32 stuff, but for things like Seeed R2040 devices, Arduino IDE is a must (VSCode doesn’t yet support it).  With the Raspberry Pi, you can use Python, which is not a compiled code, and it takes literally seconds to move the code to the device using a program like winSCP (i.e. Secure CoPy).  Thanks for the comments – I don’t think what you are suggesting is happening.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.