TL;DR
In order to help understand the context and importance of this beta testing initiative, I will provide some background information below. If you aren't interested in the boring details at this time and just want to get to the beta testing, feel free to skip over that "Background" section and go straight to the "Call for Beta Testers!" section below.
Background
Compilation Optimization
A common complaint from the Arduino community is of unexpectedly long durations of sketch compilation/builds.
The developers have done some significant work to improve on the performance in the past. This work included parallelization of the compilation processes, and a cache system, where the objects produce by a compilation are stored, then reused in subsequent compilations when appropriate. This means that the actual compilation phase of the sketch build is fairly optimized at this point and there isn't a lot of low hanging fruit left to improve there.
Library Discovery
There is another significant phase of the sketch build process, which is the library discovery: In order to make Arduino project development accessible to everyone, the sketch build system automatically configures the compiler's "search path" with the paths of each of the libraruy dependencies of the sketch. This is a significant difference from traditional C++ development, where the user must manually configure these paths (which would be incredibly difficult for the average Arduino beginner to accomplish).
Library discovery is accomplished done by repeatedly preprocessing the sketch and then searching the library installation folders for the library that provides the header files that were not found by the compiler, adding that path to the compiler's search path, the repeating until the preprocessing is successful (see the flowchart here for an overview of the process). This fairly resource intensive process is performed on every compilation.
This phase produces the content you will see under the "Detecting libraries used..." section of the verbose compilation. For example:
Detecting libraries used...
C:\Users\per\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=atmega32u4 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Leonardo" -IC:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\leonardo C:\Users\per\AppData\Local\Temp\arduino\sketches\C2DF9AB8624136325E85A8703D7AF1C8\sketch\ManyIncludes.ino.cpp -o nul
Alternatives for Ethernet.h: [Ethernet@2.0.2]
ResolveLibrary(Ethernet.h)
-> candidates: [Ethernet@2.0.2]
C:\Users\per\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=atmega32u4 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Leonardo" -IC:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\leonardo -IC:\Users\per\Documents\Arduino\libraries\libraries\Ethernet\src C:\Users\per\AppData\Local\Temp\arduino\sketches\C2DF9AB8624136325E85A8703D7AF1C8\sketch\ManyIncludes.ino.cpp -o nul
Alternatives for Keyboard.h: [Keyboard@1.0.6]
ResolveLibrary(Keyboard.h)
-> candidates: [Keyboard@1.0.6]
C:\Users\per\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=atmega32u4 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Leonardo" -IC:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\leonardo -IC:\Users\per\Documents\Arduino\libraries\libraries\Ethernet\src -IC:\Users\per\Documents\Arduino\libraries\libraries\Keyboard\src C:\Users\per\AppData\Local\Temp\arduino\sketches\C2DF9AB8624136325E85A8703D7AF1C8\sketch\ManyIncludes.ino.cpp -o nul
[...]
(note that a new -I
flag for the previously discovered library is added to the avr-g++ -E
command at each iteration)
Library Discovery Optimization Work
The Arduino CLI developers have been working on making the library discovery process multi-threaded in order to reduce the duration of the process:
This work will benefit users of Arduino IDE and Arduino Cloud Editor in addition to those who use Arduino CLI directly.
Call for Beta Testers!
Since this is a fairly complex change, we are hoping the community can help us to get good testing coverage across a variety of real world environments and sketches. I'll provide instructions you can follow to get the tester build that contains this optimization work:
- Sign in to your GitHub account.
(GitHub only allows downloads of the tester builds when you are signed in.) - Open this page in your browser:
https://github.com/arduino/arduino-cli/actions/runs/10305203157?pr=2625#artifacts - Click the appropriate link for your operating system under the "Artifacts" section of the page:
- If you are using Linux: "Linux_X86-64"
- If you are using macOS (Apple Silicon processor): "macOS_ARM64"
- If you are using Windows: "Windows_X86-64"
- Wait for the download to finish.
- Extract the downloaded file.
- Extract the ZIP file you find inside the extracted file.
(yes, there are two layers of ZIP files )
Now use the arduino-cli
executable you find in the extracted folder to compile your sketches. Please let us know if you encounter any problems. You can report them by commenting on the pull request thread here:
https://github.com/arduino/arduino-cli/pull/2625
If you have any questions, concerns, or problems regarding installing or using this tester build, comment here on the forum thread and I'll be happy to provide assistance.
ⓘ The tester build of Arduino CLI won't interfere with any other installations of Arduino CLI or Arduino IDE on your computer so there is no problem using beta tester versions of Arduino CLI installed in addition to the release version you use normally.