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: AceTime v2.1.0
DO NOT EDIT: This file was auto-generated using make README.md
.
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.
v1.3:
- The
BasicZoneManager
andExtendedZoneManager
classes were unified under a new parent interfaceZoneManager
. This seems to have caused the flash size to increase by around 1200 bytes on the AVR processors (Nano, Pro Micro), about 500 bytes on a SAMD, about 800 bytes on a ESP8266, 100 bytes on a ESP32, and 1400 bytes on a Teensy 3.2. The 8-bit processors suffer the most flash size increase proportional to their limited 32kB limit. - Adding the
ZoneManager
interface simplifies a lot of the complexity with saving and restoring time zones using theTimeZoneData
object, and I think it is worth the extra cost of flash size. The mitigating factor is that applications targetted towards 8-bit processors will normally have fixed number of timezones at compile time, so they can avoid using aZoneManager
, and avoid this penalty in flash size.
v1.4.1+:
- Removed the
ZoneInfo::transitionBufSize
field from theZoneInfo
struct, which saves 1 byte on 8-bit processors (none on 32-bit processors due to 4-byte alignment). We save 266 bytes forBasicZoneManager
and 386 bytes forExtendedZoneManager
when all the zones are loaded into the zone registry. - Incorporated zoneName compression causes flash/ram usage to increase by
~250/120 bytes when using only 1-2 zones, but decreases flash consumption by
1200-2400 bytes when all the zones are loaded into the
ZoneManager
.
v1.5+:
- Changing
ZoneProcessorCache::getType()
from avirtual
to a non-virtual method saves 250-350 bytes of flash memory when using aBasicZoneManager
or anExtendedZoneManager
on an 8-bit AVR processor. Unexpectedly, the flash memory consumption increases slightly (~0-50 bytes) for some ARM processors and the ESP32. Since those processors have far more flash memory, this seems like a good tradeoff. - Changing
BasicZoneProcessor
andExtendedZoneProcessor
to be subclasses of the templatizedBasicZoneProcessorTemplate
andExtendedZoneProcessorTemplate
classes causes reduction of flash consumption by 250-400 bytes for 32-bit processors. Don't know why. (Very little difference for 8-bit AVR). - Adding a
BrokerFactory
layer of indirection (to support more complex ZoneProcessors and Brokers) causes flash memory to go up by 100-200 bytes.
v1.6:
- Added support for
LinkRegistry
toBasicZoneManager
andExtendedZoneManager
. This increases the flash memory usage by 150-500 bytes when using one of these classes due to the code required byLinkRegistrar
. This extra cost is incurred even if theLinkRegistry
is set to 0 elements. EachLinkEntry
consumes 8 bytes (2 xuint32_t
). So azonedb::kLinkRegistry
with 183 elements uses 1464 extra bytes of flash; azonedbx::kLinkRegistry
with 207 elements uses 1656 extra bytes.
v1.7:
- The virtual destructor on the
Clock
base class removed. This reduced the flash usage by 618 bytes on AVR processors , 328 bytes on the SAMD21, but only 50-60 bytes on other 32-bit processors. - The various
printShortNameTo()
orprintShortTo()
methods changed to replace the underscore in the zone names (e.g.Los_Angeles
) with spaces (e.g.Los Angeles
) to be more human friendly. This made little difference in the flash memory consumption, except on the ESP32 where it increased by 200-300 bytes.
v1.7.2
- The
SystemClock::clockMillis()
is now non-virtual, using compile-time polymorphism through C++ template, and incorporating the same techniques from AceRoutine v1.3. Saves about 20-40 bytes of flash.
v1.7.5:
ExtendedZoneProcessor.compareTransitionToMatch()
was modified to detect an exact equality between aTransition
and itsMatchingEra
if any of the 3 time stamp versions ('w', 's', 'u') are equal. Adds about 120-150 bytes of flash on 8-bit and 32-bit processors. But removingoriginalTransitionTime
fromTransition
decreases flash usage by about 20 bytes.- Upgrade ESP8266 Core from 2.7.4 to 3.0.2. Flash consumption increases by 3-5 kB across the board.
- Upgrade Teensyduino from 1.54 to 1.55. Add memory consumed by
malloc()
andfree()
when using classes with virtual methods into baseline MemoryBenchmark, reducing the actual memory usage of various features by ~3kB.
v1.8.0:
- Move Clock and SystemClock benchmarks into AceTimeClock v1.0.0.
- Extract thin links from BasicZoneManager and ExtendedZoneManager into
new BasicLinkManager and ExtendedLinkManager classes.
- Saves 200-500 bytes of flash for BasicZoneManager and ExtendedZoneManager.
- Applications can decide whether to use thin links through the LinkManager
(~2000 flash bytes for AVR) or use fat links through the
kZoneAndLinkRegistry
(~5000 flash bytes for AVR).
- Create various test objects as global variables instead of stack variables to get a more accurate measurement of their static memory consumption.
v1.9.0:
- Reduce flash usage of
BasicZoneManager
andExtendedZoneManager
by 1100-1300 bytes on AVR processors:- Extract
BasicZoneProcessorCache
andExtendedZoneProcessorCache
out ofBasicZoneManager
andExtendedZoneManager
, making them non-templatized. - Remove all
virtual
methods fromZoneManager
, making the ZoneManager hierarchy non-polymorphic. - Looks like I am reverting some of the changes made in v1.3 when I created
the
ZoneManager
interface.
- Extract
- Reduce flash usage of
BasicLinkManager
andExtendedLinkManager
by 68 bytes on AVR processors by removing purevirtual
methods onLinkManager
base class. - Increase flash usage by 34 bytes on AVR processors due to slight refactoring
of
getHighWater()
withgetAllocSize()
. Only 4-8 bytes increase on 32-bit processors.
v1.10.0:
- Remove support for SAMD21 boards.
- Arduino IDE 1.8.19 with SparkFun SAMD 1.8.6 can no longer upload binaries to these boards. Something about bossac 1.7.0 not found.
- Add memory consumption benchmarks for
ZoneSorterByName
andZoneSorterByOffsetAndName
forBasicZoneManager
andExtendedZoneManager
.- AVR: 180-530 bytes of flash
- 32-bit: 120-600 bytes of flash
- Upgrade tool chain:
- Arduino IDE from 1.8.13 to 1.8.19
- Arduino AVR from 1.8.3 to 1.8.4
- STM32duino from 2.0.0 to 2.2.0
- ESP32 from 1.0.6 to 2.0.2
- Teensyduino from 1.55 to 1.56
- Add support for
fold
parameter inLocalDateTime
,OffsetDateTime
,ZonedDateTime
, andExtendedZoneProcessor
. Increases flash usage:- AVR:
- ~600 bytes, in
ExtendedZoneProcessor
for additional search logic, - ~150 bytes,
BasicZoneProcessor
, to carry along thefold
parameter
- ~600 bytes, in
- most 32-bit: 400-600 bytes
- Teensy: 1300 bytes (no idea why)
- AVR:
v1.11.0
- Upgrade ZoneInfo database so that Links are symbolic links to Zones, instead
of hard links to Zones.
- Allows Links to know whether they are links.
- Allows extraction of the zoneId and zoneNames of the target Zone.
- AVR: Increases flash consumption by ~270 bytes.
- STM32: Increases flash by 120-150 bytes.
- ESP8266: Increases flash by 250-300 bytes.
- ESP32: Increases flash by ~190 bytes.
- Teensy 3.2: Increase flash by 450-1300 bytes.
v1.11.1
- Change
ZoneInfoBroker::targetZoneInfo()
method to return aZoneInfoBroker
instead of rawZoneInfo*
pointer.- Increases flash usage by 4-16 bytes for the most part.
v1.11.5
- Upgrade tool chain
- Arduino CLI from 0.20.2 to 0.27.1
- Arduino AVR Core from 1.8.4 to 1.8.5
- STM32duino from 2.2.0 to 2.3.0
- ESP32 Core from 2.0.2 to 2.0.5
- Teensyduino from 1.56 to 1.57
- Upgrade TZDB from 2022b to 2022d
v2.0
- Use
int16_t
year fields. - Implement adjustable epoch year.
- Upgrade to TZDB 2022f.
- AVR:
- BasicZoneManager increases ~200 bytes
- ExtendedZoneManager increases ~500 bytes
zonedb
increases ~1.5 kiBzonedbx
increases ~3 kiB
- ESP8266
- BasicZoneManager increases ~50 bytes
- ExtendedZoneManager increases ~150 bytes
zonedb
increases ~300 byteszonedbx
increases ~1.5 kiB
v2.0.1
- Upgrade to TZDB 2022g.
- Incorporate
ZonedExtra
to replace variousTimeZone
methods.
v2.1.0
- Remove
LinkManager
andLinkRegistry
. - Unify links, adding an additional
targetInfo
field inZoneInfo
.- Increases flash by ~1kB on 8-bit and ~2kB on 32-bit for ~600 zones.
- [1] Delta flash and ram consumption for
ZoneSorterByName
andZoneSorterByOffsetAndName
are calculated by subtracting theBasicZoneManager (1 zone)
numbers, to isolate the memory consumption of just the sorter classes. - [2] Delta flash and ram consumption for
ZoneSorterByName
andZoneSorterByOffsetAndName
are calculated by subtracting theExtendedZoneManager (1 zone)
numbers, to isolate the memory consumption of just the sorter classes.
- 16MHz ATmega328P
- Arduino IDE 1.8.19, Arduino CLI 0.27.1
- Arduino AVR Boards 1.8.5
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| baseline | 474/ 11 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| LocalDateTime | 1108/ 21 | 634/ 10 |
| ZonedDateTime | 1440/ 28 | 966/ 17 |
| Manual ZoneManager | 1398/ 13 | 924/ 2 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 6570/ 321 | 6096/ 310 |
| Basic TimeZone (2 zones) | 7008/ 447 | 6534/ 436 |
| BasicZoneManager (1 zone) | 6772/ 332 | 6298/ 321 |
| BasicZoneManager (all zones) | 19280/ 708 | 18806/ 697 |
| BasicZoneManager (all zones+links) | 24632/ 708 | 24158/ 697 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 7384/ 334 | 612/ 2 |
| Basic ZoneSorterByOffsetAndName [1] | 7554/ 334 | 782/ 2 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 9978/ 702 | 9504/ 691 |
| Extended TimeZone (2 zones) | 10462/ 1175 | 9988/ 1164 |
| ExtendedZoneManager (1 zone) | 10154/ 708 | 9680/ 697 |
| ExtendedZoneManager (all zones) | 34116/ 1192 | 33642/ 1181 |
| ExtendedZoneManager (all zones+links) | 40118/ 1192 | 39644/ 1181 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 10766/ 710 | 612/ 2 |
| Extended ZoneSorterByOffsetAndName [2] | 10946/ 710 | 792/ 2 |
+---------------------------------------------------------------------+
- 16 MHz ATmega32U4
- Arduino IDE 1.8.19, Arduino CLI 0.27.1
- SparkFun AVR Boards 1.1.13
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| baseline | 3470/ 153 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| LocalDateTime | 4080/ 161 | 610/ 8 |
| ZonedDateTime | 4412/ 168 | 942/ 15 |
| Manual ZoneManager | 4392/ 153 | 922/ 0 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 9524/ 459 | 6054/ 306 |
| Basic TimeZone (2 zones) | 9964/ 587 | 6494/ 434 |
| BasicZoneManager (1 zone) | 9726/ 470 | 6256/ 317 |
| BasicZoneManager (all zones) | 22252/ 848 | 18782/ 695 |
| BasicZoneManager (all zones+links) | 27604/ 848 | 24134/ 695 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 10338/ 472 | 612/ 2 |
| Basic ZoneSorterByOffsetAndName [1] | 10508/ 472 | 782/ 2 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 12932/ 840 | 9462/ 687 |
| Extended TimeZone (2 zones) | 13418/ 1315 | 9948/ 1162 |
| ExtendedZoneManager (1 zone) | 13108/ 846 | 9638/ 693 |
| ExtendedZoneManager (all zones) | 37086/ 1330 | 33616/ 1177 |
| ExtendedZoneManager (all zones+links) | 43088/ 1330 | 39618/ 1177 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 13720/ 848 | 612/ 2 |
| Extended ZoneSorterByOffsetAndName [2] | 13900/ 848 | 792/ 2 |
+---------------------------------------------------------------------+
- STM32F103C8, 72 MHz ARM Cortex-M3
- Arduino IDE 1.8.19, Arduino CLI 0.27.1
- STM32duino 2.3.0
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| baseline | 21336/ 3556 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| LocalDateTime | 21684/ 3572 | 348/ 16 |
| ZonedDateTime | 22424/ 3588 | 1088/ 32 |
| Manual ZoneManager | 22412/ 3564 | 1076/ 8 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 25812/ 3728 | 4476/ 172 |
| Basic TimeZone (2 zones) | 26156/ 3892 | 4820/ 336 |
| BasicZoneManager (1 zone) | 25936/ 3748 | 4600/ 192 |
| BasicZoneManager (all zones) | 42580/ 3748 | 21244/ 192 |
| BasicZoneManager (all zones+links) | 50788/ 3748 | 29452/ 192 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 26396/ 3752 | 460/ 4 |
| Basic ZoneSorterByOffsetAndName [1] | 26440/ 3752 | 504/ 4 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 27776/ 4164 | 6440/ 608 |
| Extended TimeZone (2 zones) | 28128/ 4764 | 6792/ 1208 |
| ExtendedZoneManager (1 zone) | 27896/ 4172 | 6560/ 616 |
| ExtendedZoneManager (all zones) | 59588/ 4172 | 38252/ 616 |
| ExtendedZoneManager (all zones+links) | 68776/ 4172 | 47440/ 616 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 28360/ 4176 | 464/ 4 |
| Extended ZoneSorterByOffsetAndName [2] | 28408/ 4176 | 512/ 4 |
+---------------------------------------------------------------------+
An entry of -1
indicates that the memory usage exceeded the maximum of the
microcontroller and the compiler did not generate the desired information.
- NodeMCU 1.0, 80MHz ESP8266
- Arduino IDE 1.8.19, Arduino CLI 0.27.1
- ESP8266 Boards 3.0.2
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| baseline | 260089/27892 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| LocalDateTime | 260613/27912 | 524/ 20 |
| ZonedDateTime | 261733/27928 | 1644/ 36 |
| Manual ZoneManager | 261713/27900 | 1624/ 8 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 266749/28648 | 6660/ 756 |
| Basic TimeZone (2 zones) | 267245/28808 | 7156/ 916 |
| BasicZoneManager (1 zone) | 266909/28664 | 6820/ 772 |
| BasicZoneManager (all zones) | 283853/28664 | 23764/ 772 |
| BasicZoneManager (all zones+links) | 292333/28664 | 32244/ 772 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 267549/28672 | 640/ 8 |
| Basic ZoneSorterByOffsetAndName [1] | 267661/28672 | 752/ 8 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 269021/29224 | 8932/ 1332 |
| Extended TimeZone (2 zones) | 269581/29824 | 9492/ 1932 |
| ExtendedZoneManager (1 zone) | 269165/29232 | 9076/ 1340 |
| ExtendedZoneManager (all zones) | 301313/29228 | 41224/ 1336 |
| ExtendedZoneManager (all zones+links) | 310849/29228 | 50760/ 1336 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 269789/29240 | 624/ 8 |
| Extended ZoneSorterByOffsetAndName [2] | 269901/29240 | 736/ 8 |
+---------------------------------------------------------------------+
- ESP32-01 Dev Board, 240 MHz Tensilica LX6
- Arduino IDE 1.8.19, Arduino CLI 0.27.1
- ESP32 Boards 2.0.5
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| baseline | 211065/16056 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| LocalDateTime | 213445/16064 | 2380/ 8 |
| ZonedDateTime | 214593/16080 | 3528/ 24 |
| Manual ZoneManager | 214601/16056 | 3536/ 0 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 218509/16216 | 7444/ 160 |
| Basic TimeZone (2 zones) | 219069/16384 | 8004/ 328 |
| BasicZoneManager (1 zone) | 218657/16240 | 7592/ 184 |
| BasicZoneManager (all zones) | 235569/16240 | 24504/ 184 |
| BasicZoneManager (all zones+links) | 244049/16240 | 32984/ 184 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 219205/16240 | 548/ 0 |
| Basic ZoneSorterByOffsetAndName [1] | 219241/16240 | 584/ 0 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 220593/16656 | 9528/ 600 |
| Extended TimeZone (2 zones) | 221161/17256 | 10096/ 1200 |
| ExtendedZoneManager (1 zone) | 220709/16664 | 9644/ 608 |
| ExtendedZoneManager (all zones) | 252837/16664 | 41772/ 608 |
| ExtendedZoneManager (all zones+links) | 262373/16664 | 51308/ 608 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 221265/16664 | 556/ 0 |
| Extended ZoneSorterByOffsetAndName [2] | 221309/16664 | 600/ 0 |
+---------------------------------------------------------------------+
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.
- 96 MHz ARM Cortex-M4
- Arduino IDE 1.8.19, Arduino CLI 0.27.1
- Teensyduino 1.57
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| baseline | 10060/ 4152 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| LocalDateTime | 10424/ 4168 | 364/ 16 |
| ZonedDateTime | 10468/ 4184 | 408/ 32 |
| Manual ZoneManager | 10196/ 4160 | 136/ 8 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 20500/ 4324 | 10440/ 172 |
| Basic TimeZone (2 zones) | 21980/ 4488 | 11920/ 336 |
| BasicZoneManager (1 zone) | 20760/ 4344 | 10700/ 192 |
| BasicZoneManager (all zones) | 37636/ 4344 | 27576/ 192 |
| BasicZoneManager (all zones+links) | 46120/ 4344 | 36060/ 192 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 21272/ 4348 | 512/ 4 |
| Basic ZoneSorterByOffsetAndName [1] | 21336/ 4348 | 576/ 4 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 24640/ 4760 | 14580/ 608 |
| Extended TimeZone (2 zones) | 26184/ 5360 | 16124/ 1208 |
| ExtendedZoneManager (1 zone) | 24900/ 4768 | 14840/ 616 |
| ExtendedZoneManager (all zones) | 56996/ 4768 | 46936/ 616 |
| ExtendedZoneManager (all zones+links) | 66524/ 4768 | 56464/ 616 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 25412/ 4772 | 512/ 4 |
| Extended ZoneSorterByOffsetAndName [2] | 25476/ 4772 | 576/ 4 |
+---------------------------------------------------------------------+