In late July, the Arduino IDE - or, more accurately, the toolchains bundled with the Arduino IDE - received a much-needed overhaul with the promise that users of AVR-based Arduinos and Genuinos like the Uno and Mega could expect smaller sketch sizes and increased performance. Since the AVR Core was updated to 1.6.10, we've been doing some in-house testing to verify these claims - delayed somewhat by several subsequent releases, up to the current AVR Core 1.6.13 revision.
We've already discussed the claim of reduced binary sizes, but it's worth going over our findings again. Depending on the complexity of the sketch, you can expect to shave off anything from a paltry one per cent to 24 per cent from the size of the final binary. This, of course, is fantastic news for users of smaller AVR-based devices like the ATmega168-based Uno variants, which can have as little as 14KB of space available for sketch storage. The below graph should put things into perspective: if you're building something massive, you'll probably still need to switch to a more capacious chip; if you're just tickling the edges of the flash capacity, though, the new compiler can mean the difference between success and failure.
The new toolchain also came with the promise of improved performance. To verify this claim, we turned to two classic benchmarks: Dhrystone, which measures integer compute performance, and Whetstone, which measures floating-point compute performance. The results were, as the graph below demonstrates, conclusive: switching from AVR Core 1.6.9 to AVR Core 1.6.13 sees the Dhrystone benchmark running on an Arduino Uno go from 6.25 million instructions per second (MIPS) to 10.15 MIPS; the Whetstone benchmark jumps from 1.17 million Whetstone instructions per second (MWIPS) to 6.23 MWIPS - far higher than we were expecting to see.
Crunching numbers isn't a AVR's primary purpose, however, and a gain in one area can sometimes result in losses elsewhere. The most common use for an Arduino is for the digitalRead() and digitalWrite() instructions, and our final test addresses these aspects. Using IOBench, we were able to take three readings: 'soft' benchmarks of the speed at which the chip could constantly run digitalRead() and digitalWrite() on a pin, and a 'hard' benchmark where the Uno was set to toggle a pin on and off while a frequency counter measured the performance. The results can be found below.
The synthetic 'soft' benchmarks - which, it must be noted, only take into account how quickly the Arduino can run the read and write instructions, not whether such rapid reads will actually result in valid data - show a clear performance boost. The 'hard' benchmark, though, shows a much smaller gain, going from 95.66 KHz in 1.6.9 to 108 KHz in 1.6.13 - a great example of how synthetic benchmarks can mislead.
Any gain in performance is to be welcomed, however, and for anyone who hasn't yet got around to upgrading we can heartily recommend picking up the latest Arduino IDE. To check that you're on the latest AVR Core, too, head into the Tools menu, followed by Board, then use the Boards Manager to make sure that the "Arduino AVR Boards" package is at version 1.6.13 or higher.