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.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
- [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 | 1294/ 28 | 820/ 17 |
| Manual ZoneManager | 1234/ 13 | 760/ 2 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 6762/ 325 | 6288/ 314 |
| Basic TimeZone (2 zones) | 6930/ 451 | 6456/ 440 |
| BasicZoneManager (1 zone) | 6968/ 336 | 6494/ 325 |
| BasicZoneManager (all zones) | 19056/ 712 | 18582/ 701 |
| BasicZoneManager (all zones+links) | 23992/ 712 | 23518/ 701 |
| BasicLinkManager (all links) | 2594/ 16 | 2120/ 5 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 7140/ 336 | 378/ 11 |
| Basic ZoneSorterByOffsetAndName [1] | 7264/ 336 | 502/ 11 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 10320/ 706 | 9846/ 695 |
| Extended TimeZone (2 zones) | 10526/ 1179 | 10052/ 1168 |
| ExtendedZoneManager (1 zone) | 10496/ 712 | 10022/ 701 |
| ExtendedZoneManager (all zones) | 33720/ 1196 | 33246/ 1185 |
| ExtendedZoneManager (all zones+links) | 39206/ 1196 | 38732/ 1185 |
| ExtendedLinkManager (all links) | 2786/ 16 | 2312/ 5 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 10688/ 712 | 368/ 6 |
| Extended ZoneSorterByOffsetAndName [2] | 10810/ 712 | 490/ 6 |
+---------------------------------------------------------------------+
- 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 | 4266/ 168 | 796/ 15 |
| Manual ZoneManager | 4228/ 153 | 758/ 0 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 9716/ 463 | 6246/ 310 |
| Basic TimeZone (2 zones) | 9886/ 591 | 6416/ 438 |
| BasicZoneManager (1 zone) | 9922/ 474 | 6452/ 321 |
| BasicZoneManager (all zones) | 22028/ 852 | 18558/ 699 |
| BasicZoneManager (all zones+links) | 26964/ 852 | 23494/ 699 |
| BasicLinkManager (all links) | 5568/ 158 | 2098/ 5 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 10096/ 476 | 380/ 13 |
| Basic ZoneSorterByOffsetAndName [1] | 10220/ 476 | 504/ 13 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 13274/ 844 | 9804/ 691 |
| Extended TimeZone (2 zones) | 13482/ 1319 | 10012/ 1166 |
| ExtendedZoneManager (1 zone) | 13450/ 850 | 9980/ 697 |
| ExtendedZoneManager (all zones) | 36690/ 1334 | 33220/ 1181 |
| ExtendedZoneManager (all zones+links) | 42176/ 1334 | 38706/ 1181 |
| ExtendedLinkManager (all links) | 5760/ 158 | 2290/ 5 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 13644/ 852 | 370/ 8 |
| Extended ZoneSorterByOffsetAndName [2] | 13766/ 852 | 492/ 8 |
+---------------------------------------------------------------------+
- 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 | 21920/ 3588 | 584/ 32 |
| Manual ZoneManager | 21908/ 3564 | 572/ 8 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 25820/ 3728 | 4484/ 172 |
| Basic TimeZone (2 zones) | 26116/ 3892 | 4780/ 336 |
| BasicZoneManager (1 zone) | 25944/ 3748 | 4608/ 192 |
| BasicZoneManager (all zones) | 41728/ 3748 | 20392/ 192 |
| BasicZoneManager (all zones+links) | 49092/ 3748 | 27756/ 192 |
| BasicLinkManager (all links) | 23264/ 3564 | 1928/ 8 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 26132/ 3748 | 312/ 20 |
| Basic ZoneSorterByOffsetAndName [1] | 26180/ 3748 | 360/ 20 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 27900/ 4164 | 6564/ 608 |
| Extended TimeZone (2 zones) | 28196/ 4764 | 6860/ 1208 |
| ExtendedZoneManager (1 zone) | 28012/ 4172 | 6676/ 616 |
| ExtendedZoneManager (all zones) | 58252/ 4172 | 36916/ 616 |
| ExtendedZoneManager (all zones+links) | 66420/ 4172 | 45084/ 616 |
| ExtendedLinkManager (all links) | 23456/ 3564 | 2120/ 8 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 28208/ 4172 | 308/ 8 |
| Extended ZoneSorterByOffsetAndName [2] | 28264/ 4172 | 364/ 8 |
+---------------------------------------------------------------------+
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 | 260965/27928 | 876/ 36 |
| Manual ZoneManager | 260961/27900 | 872/ 8 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 266813/28648 | 6724/ 756 |
| Basic TimeZone (2 zones) | 267213/28808 | 7124/ 916 |
| BasicZoneManager (1 zone) | 266957/28664 | 6868/ 772 |
| BasicZoneManager (all zones) | 283037/28664 | 22948/ 772 |
| BasicZoneManager (all zones+links) | 290685/28664 | 30596/ 772 |
| BasicLinkManager (all links) | 262141/27904 | 2052/ 12 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 267241/28668 | 428/ 20 |
| Basic ZoneSorterByOffsetAndName [1] | 267337/28668 | 524/ 20 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 269501/29224 | 9412/ 1332 |
| Extended TimeZone (2 zones) | 269917/29824 | 9828/ 1932 |
| ExtendedZoneManager (1 zone) | 269613/29232 | 9524/ 1340 |
| ExtendedZoneManager (all zones) | 300321/29228 | 40232/ 1336 |
| ExtendedZoneManager (all zones+links) | 308833/29228 | 48744/ 1336 |
| ExtendedLinkManager (all links) | 262333/27904 | 2244/ 12 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 269849/29236 | 348/ 12 |
| Extended ZoneSorterByOffsetAndName [2] | 269929/29236 | 428/ 12 |
+---------------------------------------------------------------------+
- 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 | 213285/16064 | 2220/ 8 |
| ZonedDateTime | 213713/16080 | 2648/ 24 |
| Manual ZoneManager | 213737/16056 | 2672/ 0 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 218385/16216 | 7320/ 160 |
| Basic TimeZone (2 zones) | 218845/16384 | 7780/ 328 |
| BasicZoneManager (1 zone) | 218541/16240 | 7476/ 184 |
| BasicZoneManager (all zones) | 234589/16240 | 23524/ 184 |
| BasicZoneManager (all zones+links) | 242237/16240 | 31172/ 184 |
| BasicLinkManager (all links) | 214833/16064 | 3768/ 8 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 218733/16240 | 348/ 24 |
| Basic ZoneSorterByOffsetAndName [1] | 218789/16240 | 404/ 24 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 220825/16656 | 9760/ 600 |
| Extended TimeZone (2 zones) | 221249/17256 | 10184/ 1200 |
| ExtendedZoneManager (1 zone) | 220921/16664 | 9856/ 608 |
| ExtendedZoneManager (all zones) | 251609/16664 | 40544/ 608 |
| ExtendedZoneManager (all zones+links) | 260105/16664 | 49040/ 608 |
| ExtendedLinkManager (all links) | 215025/16064 | 3960/ 8 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 221093/16664 | 268/ 8 |
| Extended ZoneSorterByOffsetAndName [2] | 221161/16664 | 336/ 8 |
+---------------------------------------------------------------------+
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 | 10500/ 4184 | 440/ 32 |
| Manual ZoneManager | 10196/ 4160 | 136/ 8 |
|----------------------------------------+--------------+-------------|
| Basic TimeZone (1 zone) | 23192/ 4324 | 13132/ 172 |
| Basic TimeZone (2 zones) | 24216/ 4488 | 14156/ 336 |
| BasicZoneManager (1 zone) | 23452/ 4344 | 13392/ 192 |
| BasicZoneManager (all zones) | 39472/ 4344 | 29412/ 192 |
| BasicZoneManager (all zones+links) | 47116/ 4344 | 37056/ 192 |
| BasicLinkManager (all links) | 12000/ 4160 | 1940/ 8 |
|----------------------------------------+--------------+-------------|
| Basic ZoneSorterByName [1] | 23260/ 4348 | 68/ 24 |
| Basic ZoneSorterByOffsetAndName [1] | 23708/ 4348 | 516/ 24 |
|----------------------------------------+--------------+-------------|
| Extended TimeZone (1 zone) | 26436/ 4760 | 16376/ 608 |
| Extended TimeZone (2 zones) | 27524/ 5360 | 17464/ 1208 |
| ExtendedZoneManager (1 zone) | 26632/ 4768 | 16572/ 616 |
| ExtendedZoneManager (all zones) | 57344/ 4768 | 47284/ 616 |
| ExtendedZoneManager (all zones+links) | 65852/ 4768 | 55792/ 616 |
| ExtendedLinkManager (all links) | 12192/ 4160 | 2132/ 8 |
|----------------------------------------+--------------+-------------|
| Extended ZoneSorterByName [2] | 26504/ 4772 | 68/ 12 |
| Extended ZoneSorterByOffsetAndName [2] | 26952/ 4772 | 516/ 12 |
+---------------------------------------------------------------------+