6

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?

7
  • Have you tried enabling verbose compilation so that you can see exactly what's happening? Feb 10, 2015 at 14:10
  • @Ignacio: updated the question Feb 10, 2015 at 14:31
  • Try using version 1.5. 1.6 is just out, so it might have some bugs.
    – Gerben
    Feb 10, 2015 at 14:50
  • 1
    @Gerben: before I upgraded (today) I used 1.0.6, and it acted the same. Thanks for your comment. Feb 10, 2015 at 14:57
  • Run check disk and also run spin rite on your drive. It's possible your spinning disk is failing.
    – benathon
    May 12, 2015 at 11:50

6 Answers 6

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.

2
  • 2
    Any reason for the downvote? - Visual Micro does consistently compile faster than the Arduino IDE. Even simple programs take a long time to compile in the Arduino IDE at the best of times compared to using other tools.
    – Élie
    Jun 13, 2015 at 5:19
  • Setting the option "High Speed Parallel Builds" under vMirco options really speed up the build for me. 'm using VS Studio Communiti Edition with Visual Micro.
    – thowa
    Dec 21, 2019 at 0:15
3

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.

4
  • Do you plan to support FreeBSD? - UECIDE looks promising. For now, I have to run a slow VM with windows. Would like something snappy like this IDE.
    – user400344
    Aug 19, 2016 at 1:44
  • The IDE itself is just a Java application. As such it should run fine on FreeBSD. I had it going on there myself once - even made a port for it (in the early days that is). It should still run fine, though may require a little bit of bending. Use the Linux ZIP version and edit the uecide script file to suit. The hard part though will be getting the plugins to work. They need native binaries, such as compilers, programmers, etc. If you can find those kind of things for FreeBSD then you may have some success at making it work - if not, not.
    – Majenko
    Aug 19, 2016 at 13:03
  • You can try using the FreeBSD Linux Binary Emulation system instead of a Windows VM to run the Linux version of UECIDE along with the Linux binaries. Not sure what the plugin system would make of that though.
    – Majenko
    Aug 19, 2016 at 13:04
  • Sounds about as painful as expected :/ I'll grab UECIDE for my VM instead ;)
    – user400344
    Aug 19, 2016 at 15:28
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.

1
  • Specifically, look to see if you've got Trusteer Rapport installed. Its some kind of banking protection mechanism, but I found it slowed down my compile horrendously. Removed and it's so much snappier. I've lived with this for soooo long so glad to have nailed the cause.
    – Mat
    Mar 21, 2021 at 18:25
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.

3
  • 1
    Hi Yakov and welcome to SE Arduino. Thanks for providing the links, I am sure that they are useful. However, it is much better if you can provide answers that you have tested yourself and that have worked for you. If you obtained the solution, that worked for you, from a thread such as those which you have posted, then all well and good. However, try to refrain from just googling links and posting them as answers, without trying them first... :-) Feb 2, 2016 at 6:32
  • Hi @Greenonline, fair enough, I'll report my results once I test these suggestions. It's just the issue doesn't seem to be simple and many users suffer it because of different causes, so I think some solutions successful for others are no less useful than the one which will help me. As for the issue, I have to test several things, including - IDE recompiles the whole thing each time? (this is mentioned in some threads, but I have no idea how to check this) - smth consumimg CPU? (don't see anything in task manager) - anything I can configure in Comodo? (HIPS.. looks like all is permitted for )
    – YakovL
    Feb 2, 2016 at 18:17
  • Ok, there's a simple way to understand weather your firewall (HIPS or other tech) causes the problem: just turn it off and try to compile again. In my case, this didn't accelerate compiling. Interestingly, sometimes even opposite: without firewall compiling seems to be always ~45 sec, but with firewall on it sometimes takes 17 sec.
    – YakovL
    Feb 15, 2016 at 10:34
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.

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.