I am compiling the same sketch (small; only about 200 lines) on two different PCs and they behave very differently.
Computer A takes more than 30 seconds to compile the sketch; computer B takes less than 3 seconds. Looking at the verbose output they appear to go through identical stages with identical paths to files, although I haven't done an exhaustive comparison. There's no noticeable long pause in the output from computer A, it's just slower overall.
Computer A has the nice feature of popping help function helpers when the mouse is hovered over them, computer B does not.
Computer A also has the nice feature that by right-clicking on a function I can go to its definition; computer B does not.
Computer A is an intel i5; computer B an AMD ryzen; online comparisons suggest they are generally similar speeds
Other compilers (e.g. VS Code) run similarly on both computers.
Computer A did have lots of old unused Arduino libaries on it, but I have deleted these now.
Computer A has Windows 10 (and cannot be upgraded for some reason); computer B has Windows 11
Arduino IDE 2.3.3 on both machines
I'd prefer to use computer A because it is a desktop with big twin screens (computer B is a small laptop) but A's speed is very annoying. Suggestions?
I'm going to ask you to provide the full verbose output from a subsequent compilation on "computer A".
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open.
Check the box next to "Show verbose output during: ☐ compile" in the "Preferences" dialog.
Click the "OK" button.
The "Preferences" dialog will close.
Select Sketch > Verify/Compile from the Arduino IDE menus.
Wait for the compilation to finish.
Select Sketch > Verify/Compile from the Arduino IDE menus. ⓘ I am intentionally instructing you to compile twice. The reason is that I want to check whether Arduino IDE's compilation caching is working on your system. The first compilation is to ensure that the second compilation will be performed with a populated cache in place. I want the output from the second compilation.
Wait for the compilation to finish.
Right click on the black "Output" panel at the bottom of the Arduino IDE window.
A context menu will open.
Select Copy All from the menu.
Open a forum reply here by clicking the "Reply" button.
Click the <CODE/> icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the compilation output into the code block.
Move the cursor outside of the code block markup before you add any additional text to your reply.
Click the "Reply" button to post the output.
In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here.
Select the .txt file you saved from the "Open" dialog.
Click the "Open" button.
The dialog will close.
Click the "Reply" button to publish the post.
Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.
Thanks. Here's the output.
I'm puzzled by the Arduino15 here (same on both computers) - is an old version of the IDE lurking somewhere perhaps?
BTW both computers have SSD drives as primary drives.
FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Detecting libraries used...
C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard C:\Users\quilk\AppData\Local\Temp\arduino\sketches\44002433851449A3943F8FEFC40D721B\sketch\stepper4.ino.cpp -o nul
Alternatives for AccelStepper.h: [AccelStepper]
ResolveLibrary(AccelStepper.h)
-> candidates: [AccelStepper]
C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\quilk\Documents\Arduino\libraries\AccelStepper C:\Users\quilk\AppData\Local\Temp\arduino\sketches\44002433851449A3943F8FEFC40D721B\sketch\stepper4.ino.cpp -o nul
Alternatives for SoftwareSerial.h: [SoftwareSerial@1.0]
ResolveLibrary(SoftwareSerial.h)
-> candidates: [SoftwareSerial@1.0]
C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\quilk\Documents\Arduino\libraries\AccelStepper -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\SoftwareSerial\src C:\Users\quilk\AppData\Local\Temp\arduino\sketches\44002433851449A3943F8FEFC40D721B\sketch\stepper4.ino.cpp -o nul
Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
-> candidates: [Wire@1.0]
C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\quilk\Documents\Arduino\libraries\AccelStepper -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\SoftwareSerial\src -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src C:\Users\quilk\AppData\Local\Temp\arduino\sketches\44002433851449A3943F8FEFC40D721B\sketch\stepper4.ino.cpp -o nul
Using cached library dependencies for file: C:\Users\quilk\Documents\Arduino\libraries\AccelStepper\AccelStepper.cpp
Using cached library dependencies for file: C:\Users\quilk\Documents\Arduino\libraries\AccelStepper\MultiStepper.cpp
Using cached library dependencies for file: C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\SoftwareSerial\src\SoftwareSerial.cpp
Using cached library dependencies for file: C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\Wire.cpp
Using cached library dependencies for file: C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src\utility\twi.c
Generating function prototypes...
C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\standard -IC:\Users\quilk\Documents\Arduino\libraries\AccelStepper -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\SoftwareSerial\src -IC:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src C:\Users\quilk\AppData\Local\Temp\arduino\sketches\44002433851449A3943F8FEFC40D721B\sketch\stepper4.ino.cpp -o C:\Users\quilk\AppData\Local\Temp\3639504563\sketch_merged.cpp
C:\Users\quilk\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\Users\quilk\AppData\Local\Temp\3639504563\sketch_merged.cpp
Compiling sketch...
"C:\\Users\\quilk\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\quilk\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\quilk\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\standard" "-IC:\\Users\\quilk\\Documents\\Arduino\\libraries\\AccelStepper" "-IC:\\Users\\quilk\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\SoftwareSerial\\src" "-IC:\\Users\\quilk\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\libraries\\Wire\\src" "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B\\sketch\\stepper4.ino.cpp" -o "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B\\sketch\\stepper4.ino.cpp.o"
Compiling libraries...
Compiling library "AccelStepper"
Using previously compiled file: C:\Users\quilk\AppData\Local\Temp\arduino\sketches\44002433851449A3943F8FEFC40D721B\libraries\AccelStepper\AccelStepper.cpp.o
Using previously compiled file: C:\Users\quilk\AppData\Local\Temp\arduino\sketches\44002433851449A3943F8FEFC40D721B\libraries\AccelStepper\MultiStepper.cpp.o
Compiling library "SoftwareSerial"
Using previously compiled file: C:\Users\quilk\AppData\Local\Temp\arduino\sketches\44002433851449A3943F8FEFC40D721B\libraries\SoftwareSerial\SoftwareSerial.cpp.o
Compiling library "Wire"
Using previously compiled file: C:\Users\quilk\AppData\Local\Temp\arduino\sketches\44002433851449A3943F8FEFC40D721B\libraries\Wire\utility\twi.c.o
Using previously compiled file: C:\Users\quilk\AppData\Local\Temp\arduino\sketches\44002433851449A3943F8FEFC40D721B\libraries\Wire\Wire.cpp.o
Compiling core...
Using precompiled core: C:\Users\quilk\AppData\Local\Temp\arduino\cores\arduino_avr_uno_b4ee5e9b8ca2817b64639017604979ba\core.a
Linking everything together...
"C:\\Users\\quilk\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B/stepper4.ino.elf" "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B\\sketch\\stepper4.ino.cpp.o" "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B\\libraries\\AccelStepper\\AccelStepper.cpp.o" "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B\\libraries\\AccelStepper\\MultiStepper.cpp.o" "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B\\libraries\\SoftwareSerial\\SoftwareSerial.cpp.o" "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B\\libraries\\Wire\\Wire.cpp.o" "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B\\libraries\\Wire\\utility\\twi.c.o" "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B/..\\..\\cores\\arduino_avr_uno_b4ee5e9b8ca2817b64639017604979ba\\core.a" "-LC:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B" -lm
"C:\\Users\\quilk\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B/stepper4.ino.elf" "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B/stepper4.ino.eep"
"C:\\Users\\quilk\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B/stepper4.ino.elf" "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B/stepper4.ino.hex"
Using library AccelStepper in folder: C:\Users\quilk\Documents\Arduino\libraries\AccelStepper (legacy)
Using library SoftwareSerial at version 1.0 in folder: C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\SoftwareSerial
Using library Wire at version 1.0 in folder: C:\Users\quilk\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire
"C:\\Users\\quilk\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\quilk\\AppData\\Local\\Temp\\arduino\\sketches\\44002433851449A3943F8FEFC40D721B/stepper4.ino.elf"
Sketch uses 11264 bytes (34%) of program storage space. Maximum is 32256 bytes.
Global variables use 957 bytes (46%) of dynamic memory, leaving 1091 bytes for local variables. Maximum is 2048 bytes.
I believe that that folder is where preference files, and hardware board packages are stored.
It's not an old version of the IDE as far as I know, the folder is just called Arduino15.
Before my time, but apparently this new directory scheme was introduced with IDE 1.5 and has persisted.
The compile log shows lots of "Using cached library dependencies" and "Using previously compiled file". That takes 30 seconds on Computer A?
I've instrumented the arduino-cli back-end with a small patch, so it shows the times for each stage, most of which you can see in that log. Here's an empty sketch for Uno with <SoftwareSerial.h> and <Wire.h> (don't have the third library installed), on a re-compile
prepare 1.960
detecting libraries 0.238
function prototypes 0.118
compiling sketch 0.102
compiling libraries 0.007
compiling core 0.270
linking 0.321
final 0.352
--------
Total 3.369
The prepare stage is before it says Detecting libraries used. Not sure what it is doing there (could be "antimalware" stuff). It is over half the total time. But at least it is under 4 seconds when "not doing anything". This is on an uninspired quad-core running Windows 11. Using the CLI directly, it is easy to do a clean compile
prepare 1.746
detecting libraries 0.454
function prototypes 0.109
compiling sketch 0.102
compiling libraries 0.278
compiling core 2.426
linking 0.320
final 0.358
--------
Total 5.798
You can see it actually spends time compiling the libraries and core. Still under 6 seconds though.
The only AV is the built-in Windows one (both machines). Puzzled because the IDE is version 2.3.3, so '15' seemed to be belong to version 1.5.x which may have been installed before.
I have now compared the verbose outputs from both machines and AFAICS they are identical apart from temp file names.
....so it would appear that , rather than my desktop Win10 machine being slow, it's my little Win11 laptop that's incredibly fast, compiling (including 2 third-party libraries) in less than 2 seconds.
2 seconds (your first post said 3 seconds?) for a clean compile is fast for Windows (for Uno, maybe not incredibly so).
Seems like the code hint info is generated separately -- it says "Indexing: 1/60" or whatever in the bottom left of the IDE window and counts up -- from actual compiles, and uses CPU as well. So it's not like a "benefit" of taking longer on Computer A is those hints were included.
Have you kept an eye on CPU utilization during those 30 seconds? Is it pinned the whole time? Anything else taking CPU? Disk active time?
it's between 2 and 3 seconds, varies a bit. I'm comparing re-compiles of same code, not a clean compile.
sorry, I don't know you mean here. I haven't seen 'indexing' appearing anywhere, for either machine. But still don't know why the hints/helpers don't work on the faster machine
CPU time goes up from ~10% to ~35% (maybe 40%) on both machines during the compile. Disk access never above 2%. No other processes using anything noticable