8

Compilation of even the simplest program (like Blink) is extremely slow, the progress bar often hangs halfway for nearly half a minute.

enter image description here

Is this normal? I understand that not all computers are equally fast, but there's a huge difference between 3 seconds and 30 seconds

edit
It appears from the report that every time I switch programs they're built anew completely:

Build options changed, rebuilding all

even when nothing has been changed. How can I avoid a complete rebuild?

Joris Groosman
  • 1,191
  • 3
  • 11
  • 26

6 Answers6

5

I have found that this is a common issue across my development machines, however using Visual Micro for Visual Studio reduces this time by a significant factor.

I primarily use it for other Visual Studio features like Intellisense, refactoring, and solution management. Visual Micro has some compelling features of its own, like debugging tools, however I haven't used them.

I haven't personally tried, but I would expect that you can avoid the rebuild using the project/solution options in Visual Studio - I found that the compile time is fast enough in most cases with this environment for it to not matter.

Élie
  • 222
  • 2
  • 5
4

If you find compilation slow then yes, it is probably recompiling things that it doesn't really need to recompile. This has always been a major failing of the Arduino environment, and is one of the major impetuses for the complete re-write of the whole compilation system in my IDE UECIDE.

That includes very aggressive caching of compiled library and core files as proper ".a" files which are stored away separate from your board selection and kept until something really does need compiling. That way the first time you compile something for a board it may take 30 seconds, 50 seconds, whatever. All subsequent compilations for that same board, even for different sketches (not including the compilation time of "fresh" libraries) would be around 2 seconds, even less.

That caching is especially important when you're running on a very slow system, such as a Raspberry Pi, when compiling can take many minutes without the caches in place, but only a few seconds on all subsequent compilations.

Majenko
  • 105,851
  • 5
  • 82
  • 139
3

I had the same problem until today. Like many answers around the web, the problem seems to come from the anti-virus. My setup is Windows 10 x64 with a SSD and I use Windows Defender as the AV.

I tried by excluding the main arduino folder in "c:\program files (x86)\arduino", but it didn't improve the compilation time.

I checked the "verbose" option in the Arduino IDE and I've seen that it was calling the compiler from the AppData folder. So I add this folder to my AV exclusion list and it worked!

The compilation time improve by ten folds.

TLDR; In Windows 10, add the folder in %USERPROFILE%\AppData\Local\Arduino15 to the AV exclusion list.

NickB
  • 131
  • 3
1

This thread, Arduino IDE and ESET: Slow compilation, may be helpful if you use ESET (at least one user has reported that it helped), but it didn't help me since I'm using Comodo (and may be there are some other reasons).

Here's another thread, SLOW ARDUINO IDE regarding a solution which helped many users, since 2009 (the latest comment on the forum is dated year 2014).

Several useful posts here as well, Unbelievable slow compilation of simple sketches. Ok, I haven't tested all the solutions myself, but let me collect useful links here so that other guys can find them and I'll check them out, too.

Greenonline
  • 3,152
  • 7
  • 36
  • 48
YakovL
  • 153
  • 2
  • 10
0

I would download the non-install version and try compiling the blink sketch in it. This will let you know if it is a computer specific issue or something related to your install. I experienced something similar with a library that wasn't updated correctly between versions which caused all sorts of buggy behavior.

Nathan
  • 181
  • 3
0

The occurrence of “Build options changed, rebuilding all” (as mentioned in edited question and shown in screen shot) probably is causing the large delay. My belief (correct or not) is that lots of libraries are being rebuilt when that message appears. Ordinarily, libraries should be rebuilt only upon initial install or when changing target board type.

An arduino.cc thread, “"Build options changed, rebuilding all" even when nothing changes ==> very slow”, from 2014 treats the issue superficially, merely pointing out that Arduino 1.5.8 Beta is suitable for Yún and Arduino Due boards, not “regular Arduino” boards.

A 2011 Google code thread probably is mostly irrelevant, but it's worth trying some steps mentioned in posts #14 and 15 ‒ eg, starting arduino via a path with no spaces in names ‒ if your platform is MS Windows. If the Arduino IDE cannot find its options or preference files it probably assumes it is starting from scratch.

Note, please edit the question to specify how you started the Arduino IDE running, where the IDE is installed on your system, what your op system is, and what your computer is.

James Waldby - jwpat7
  • 8,920
  • 3
  • 21
  • 33