Skip to content

Latest commit

 

History

History

MemoryBenchmark

Memory Benchmark

The MemoryBenchmark.ino was compiled with each FEATURE_* and the flash memory and static RAM sizes were recorded. The FEATURE_BASELINE selection is the baseline, and its memory usage numbers are subtracted from the subsequent FEATURE_* memory usage.

Version: AceTimeClock v1.3.0

DO NOT EDIT: This file was auto-generated using make README.md.

How to Regenerate

To regenerate this README.md:

$ make clean_benchmarks
$ make benchmarks
$ make README.md

The make benchmarks target uses collect.sh script which calls auniter.sh (https://github.com/bxparks/AUniter) to invoke the Arduino IDE programmatically. It produces a *.txt file with the flash and ram usage information (e.g. nano.txt). It now takes about 16 minutes to generate the *.txt files on my quad-core Intel Core i7-3840QM CPU @ 2.80GHz laptop.

The make README.md command calls the generated_readme.py Python script which generates this README.md file. The ASCII tables below are generated by the generate_table.awk script, which takes each *.txt file and converts it to an ASCII table.

Library Size Changes

v1.0.0

  • Initial split from AceTime v1.7.5 for v1.8.0.
  • Convert DS3231.h into a template class for <AceWire.h>, replacing direct dependency on <Wire.h>.
    • Just including the <Wire.h> header causes flash memory to be consumed, even if Wire object is never used.
    • Saves 1000-1500 bytes of flash on AVR processors.
    • Saves 500 bytes of flash on SAMD.
    • Saves 4000 bytes of flash STM32.
    • Saves 500 bytes of flash on ESP8266.
    • Saves 3000-4000 bytes of flash on ESP32.
    • Saves 2500 bytes of flash on Teensy 3.2.
  • Add benchmark for DS3231Clock separately from SytemClock.
  • Add benchmarks for SystemClockCoroutine separately from SystemClockLoop.
  • Rename SystemClock label to SystemClockLoop.

v1.0.2

  • Fix bad merge in README.md.
  • Create benchmarks for 3 variations of DS3231Clock: TwoWire, SimpleWire, and SimpleWireFast.
    • Make sure <Wire.h> is not included when using SimpleWireInterface and SimpleWireFastInterface.
    • Flash consumption reduced by 1600 bytes using SimpleWireInterface and 2200 bytes using SimpleWireInterface on AVR.
    • Saves 800-8800 bytes of flash on 32-bit processors.

v1.1.0

  • Upgrade tool chains
    • Arduino IDE from 1.8.16 to 1.8.19
    • Arduino CLI from 0.19.2 to 0.20.2
    • STM32duino from 2.0.0 to 2.2.0
    • AVR Core from 1.8.3 to 1.8.4
    • ESP32 Core from 1.0.6 to 2.0.2
    • Teensyduino from 1.55 to 1.56
  • Add benchmark entries for:
    • StmRtcClock
    • Stm32F1Clock
    • NtpClock
    • EspSntpClock
  • ESP32
    • NtpClock and EspSntpClock increases flash usage by ~400kB and static RAM usage by ~20KB.
    • Such a large increase is not seen on the ESP8266.
    • Probably due to <WiFi.h>.
  • STM32
    • Using <STM32RTC.h> through StmRtcClock consumes an extra ~4kB of flash compared to using Stm32F1Clock.

v1.2.2

  • Upgrade tool chains
    • Arduino CLI to 0.27.1
    • STM32duino to 2.3.0
    • AVR Core from 1.8.4 to 1.8.5
    • ESP32 Core from 2.0.2 to 2.0.5
    • Teensyduino from 1.56 to 1.57
  • Upgrade to AceTime v2.0
    • Update NtpClock to use AceTime Epoch::currentEpochYear()
  • Many Clock classes increase in flash size
    • AVR: 100-400 bytes
    • ESP8266: 50-150 bytes
    • Most likely due to the adjustable AceTime epoch (Epoch::currentEpochYear()), and the change from int8_t year to int16_t year.

v1.2.4

  • Upgrade tool chains
    • Arduino CLI to 0.31.0
    • STM32duino to 2.4.0
    • AVR Core to 1.8.6
    • ESP32 Core to 2.0.7
  • Upgrade to AceTime v2.2.1

v1.3.0

  • Upgrade tool chains
  • Upgrade to AceTime v2.3

Arduino Nano

  • 16MHz ATmega328P
  • Arduino IDE 1.8.19, Arduino CLI 0.33.0
  • Arduino AVR Boards 1.8.6
+----------------------------------------------------------------------+
| Functionality                          |  flash/  ram |        delta |
|----------------------------------------+--------------+--------------|
| Baseline                               |    496/   17 |      0/    0 |
|----------------------------------------+--------------+--------------|
| DS3231Clock<TwoWire>                   |   4958/  259 |   4462/  242 |
| DS3231Clock<SimpleWire>                |   3412/   49 |   2916/   32 |
| DS3231Clock<SimpleWireFast>            |   2742/   43 |   2246/   26 |
|----------------------------------------+--------------+--------------|
| SystemClockLoop                        |   1016/   72 |    520/   55 |
| SystemClockLoop+1 Basic zone           |   8412/  124 |   7916/  107 |
| SystemClockLoop+1 Extended zone        |  12166/  124 |  11670/  107 |
|----------------------------------------+--------------+--------------|
| SystemClockCoroutine                   |   1820/  100 |   1324/   83 |
| SystemClockCoroutine+1 Basic zone      |   9186/  152 |   8690/  135 |
| SystemClockCoroutine+1 Extended zone   |  12940/  152 |  12444/  135 |
+----------------------------------------------------------------------+

Sparkfun Pro Micro

  • 16 MHz ATmega32U4
  • Arduino IDE 1.8.19, Arduino CLI 0.33.0
  • SparkFun AVR Boards 1.1.13
+----------------------------------------------------------------------+
| Functionality                          |  flash/  ram |        delta |
|----------------------------------------+--------------+--------------|
| Baseline                               |   3490/  157 |      0/    0 |
|----------------------------------------+--------------+--------------|
| DS3231Clock<TwoWire>                   |   7948/  405 |   4458/  248 |
| DS3231Clock<SimpleWire>                |   6488/  195 |   2998/   38 |
| DS3231Clock<SimpleWireFast>            |   5704/  189 |   2214/   32 |
|----------------------------------------+--------------+--------------|
| SystemClockLoop                        |   3972/  212 |    482/   55 |
| SystemClockLoop+1 Basic zone           |  11368/  264 |   7878/  107 |
| SystemClockLoop+1 Extended zone        |  15122/  264 |  11632/  107 |
|----------------------------------------+--------------+--------------|
| SystemClockCoroutine                   |   4776/  240 |   1286/   83 |
| SystemClockCoroutine+1 Basic zone      |  12142/  292 |   8652/  135 |
| SystemClockCoroutine+1 Extended zone   |  15896/  292 |  12406/  135 |
+----------------------------------------------------------------------+

Seeed Studio XIAO SAMD21

  • SAMD21, 48 MHz ARM Cortex-M0+
  • Arduino IDE 1.8.19, Arduino CLI 0.33.0
  • Seeeduino SAMD Boards 1.8.4
+----------------------------------------------------------------------+
| Functionality                          |  flash/  ram |        delta |
|----------------------------------------+--------------+--------------|
| Baseline                               |  34076/    0 |      0/    0 |
|----------------------------------------+--------------+--------------|
| DS3231Clock<TwoWire>                   |  36700/    0 |   2624/    0 |
| DS3231Clock<SimpleWire>                |  35684/    0 |   1608/    0 |
|----------------------------------------+--------------+--------------|
| SystemClockLoop                        |  34364/    0 |    288/    0 |
| SystemClockLoop+1 Basic zone           |  39140/    0 |   5064/    0 |
| SystemClockLoop+1 Extended zone        |  41252/    0 |   7176/    0 |
|----------------------------------------+--------------+--------------|
| SystemClockCoroutine                   |  34892/    0 |    816/    0 |
| SystemClockCoroutine+1 Basic zone      |  39676/    0 |   5600/    0 |
| SystemClockCoroutine+1 Extended zone   |  41780/    0 |   7704/    0 |
+----------------------------------------------------------------------+

STM32 Blue Pill

  • STM32F103C8, 72 MHz ARM Cortex-M3
  • Arduino IDE 1.8.19, Arduino CLI 0.33.0
  • STM32duino 2.6.0
+----------------------------------------------------------------------+
| Functionality                          |  flash/  ram |        delta |
|----------------------------------------+--------------+--------------|
| Baseline                               |  21360/ 4380 |      0/    0 |
|----------------------------------------+--------------+--------------|
| DS3231Clock<TwoWire>                   |  32716/ 4696 |  11356/  316 |
| DS3231Clock<SimpleWire>                |  25816/ 4468 |   4456/   88 |
|----------------------------------------+--------------+--------------|
| StmRtcClock                            |  25752/ 4456 |   4392/   76 |
| Stm32F1Clock                           |  21948/ 4416 |    588/   36 |
|----------------------------------------+--------------+--------------|
| SystemClockLoop                        |  21804/ 4464 |    444/   84 |
| SystemClockLoop+1 Basic zone           |  26524/ 4468 |   5164/   88 |
| SystemClockLoop+1 Extended zone        |  28364/ 4468 |   7004/   88 |
|----------------------------------------+--------------+--------------|
| SystemClockCoroutine                   |  22276/ 4496 |    916/  116 |
| SystemClockCoroutine+1 Basic zone      |  26988/ 4500 |   5628/  120 |
| SystemClockCoroutine+1 Extended zone   |  28840/ 4500 |   7480/  120 |
+----------------------------------------------------------------------+

SAMD51 Adafruit ItsyBitsy M4

  • SAMD51, 120 MHz ARM Cortex-M4
  • Arduino IDE 1.8.19, Arduino CLI 0.33.0
  • Adafruit SAMD 1.7.11
+----------------------------------------------------------------------+
| Functionality                          |  flash/  ram |        delta |
|----------------------------------------+--------------+--------------|
| Baseline                               |  10588/    0 |      0/    0 |
|----------------------------------------+--------------+--------------|
| DS3231Clock<TwoWire>                   |  13112/    0 |   2524/    0 |
| DS3231Clock<SimpleWire>                |  12280/    0 |   1692/    0 |
|----------------------------------------+--------------+--------------|
| SystemClockLoop                        |  10852/    0 |    264/    0 |
| SystemClockLoop+1 Basic zone           |  15596/    0 |   5008/    0 |
| SystemClockLoop+1 Extended zone        |  17488/    0 |   6900/    0 |
|----------------------------------------+--------------+--------------|
| SystemClockCoroutine                   |  11336/    0 |    748/    0 |
| SystemClockCoroutine+1 Basic zone      |  16084/    0 |   5496/    0 |
| SystemClockCoroutine+1 Extended zone   |  17968/    0 |   7380/    0 |
+----------------------------------------------------------------------+

ESP8266

  • NodeMCU 1.0, 80MHz ESP8266
  • Arduino IDE 1.8.19, Arduino CLI 0.33.0
  • ESP8266 Boards 3.0.2
+----------------------------------------------------------------------+
| Functionality                          |  flash/  ram |        delta |
|----------------------------------------+--------------+--------------|
| Baseline                               | 260109/27896 |      0/    0 |
|----------------------------------------+--------------+--------------|
| DS3231Clock<TwoWire>                   | 269573/28560 |   9464/  664 |
| DS3231Clock<SimpleWire>                | 267365/28176 |   7256/  280 |
|----------------------------------------+--------------+--------------|
| NtpClock                               | 269137/28216 |   9028/  320 |
| EspSntpClock                           | 266637/28240 |   6528/  344 |
|----------------------------------------+--------------+--------------|
| SystemClockLoop                        | 264809/28124 |   4700/  228 |
| SystemClockLoop+1 Basic zone           | 271541/28528 |  11432/  632 |
| SystemClockLoop+1 Extended zone        | 273981/28640 |  13872/  744 |
|----------------------------------------+--------------+--------------|
| SystemClockCoroutine                   | 265353/28156 |   5244/  260 |
| SystemClockCoroutine+1 Basic zone      | 272101/28560 |  11992/  664 |
| SystemClockCoroutine+1 Extended zone   | 274541/28672 |  14432/  776 |
+----------------------------------------------------------------------+

ESP32

  • ESP32-01 Dev Board, 240 MHz Tensilica LX6
  • Arduino IDE 1.8.19, Arduino CLI 0.33.0
  • ESP32 Boards 2.0.9
+----------------------------------------------------------------------+
| Functionality                          |  flash/  ram |        delta |
|----------------------------------------+--------------+--------------|
| Baseline                               | 228357/21976 |      0/    0 |
|----------------------------------------+--------------+--------------|
| DS3231Clock<TwoWire>                   | 272389/22688 |  44032/  712 |
| DS3231Clock<SimpleWire>                | 254469/22360 |  26112/  384 |
|----------------------------------------+--------------+--------------|
| NtpClock                               | 691069/44220 | 462712/22244 |
| EspSntpClock                           | 704021/44096 | 475664/22120 |
|----------------------------------------+--------------+--------------|
| SystemClockLoop                        | 245353/22304 |  16996/  328 |
| SystemClockLoop+1 Basic zone           | 250833/22320 |  22476/  344 |
| SystemClockLoop+1 Extended zone        | 252937/22320 |  24580/  344 |
|----------------------------------------+--------------+--------------|
| SystemClockCoroutine                   | 245981/22336 |  17624/  360 |
| SystemClockCoroutine+1 Basic zone      | 251437/22352 |  23080/  376 |
| SystemClockCoroutine+1 Extended zone   | 253549/22352 |  25192/  376 |
+----------------------------------------------------------------------+

RAM usage remains constant as more objects are created, which indicates that an initial pool of a certain minimum size is created regardless of the actual RAM usage by objects.