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: AceSorting v1.0.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).
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.
v0.1
- Initial version.
- The memory usage for C-library
qsort()is suspiciously low on the ESP32, only 88 bytes, compared to 800-1400 bytes for other platforms. I think this indicates that theqsort()function is already compiled into the ESP32 runtime library.
v0.3
- Add 3-argument version of sorting functions to pass in a comparison predicate, and route the 2-argument version into the 3-argument version.
- Usually no difference in flash size, as the compiler seems to be able to inline the lambda expression. In fact, some actually got a few bytes smaller.
v1.0.0
- Some minor changes to total flash consumption due to upgrading the tool chain for SAMD21, ESP8266 and TeensyDuino. The delta flash consumption of each algorithm did not change much.
- 16MHz ATmega328P
- Arduino IDE 1.8.16, Arduino CLI 0.19.2
- Arduino AVR Boards 1.8.3
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| Baseline | 1066/ 214 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| bubbleSort() | 1110/ 214 | 44/ 0 |
| insertionSort() | 1126/ 214 | 60/ 0 |
| selectionSort() | 1154/ 214 | 88/ 0 |
|----------------------------------------+--------------+-------------|
| shellSortClassic() | 1162/ 214 | 96/ 0 |
| shellSortKnuth() | 1208/ 214 | 142/ 0 |
| shellSortTokuda() | 1248/ 240 | 182/ 26 |
|----------------------------------------+--------------+-------------|
| combSort13() | 1220/ 214 | 154/ 0 |
| combSort13m() | 1238/ 214 | 172/ 0 |
| combSort133() | 1172/ 214 | 106/ 0 |
| combSort133m() | 1194/ 214 | 128/ 0 |
|----------------------------------------+--------------+-------------|
| quickSortMiddle() | 1244/ 214 | 178/ 0 |
| quickSortMedian() | 1296/ 214 | 230/ 0 |
| quickSortMedianSwapped() | 1342/ 214 | 276/ 0 |
|----------------------------------------+--------------+-------------|
| qsort() | 2150/ 214 | 1084/ 0 |
+---------------------------------------------------------------------+
- 16 MHz ATmega32U4
- Arduino 1.8.16, Arduino CLI 0.19.2
- SparkFun AVR Boards 1.1.13
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| Baseline | 4060/ 354 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| bubbleSort() | 4104/ 354 | 44/ 0 |
| insertionSort() | 4120/ 354 | 60/ 0 |
| selectionSort() | 4148/ 354 | 88/ 0 |
|----------------------------------------+--------------+-------------|
| shellSortClassic() | 4156/ 354 | 96/ 0 |
| shellSortKnuth() | 4202/ 354 | 142/ 0 |
| shellSortTokuda() | 4242/ 380 | 182/ 26 |
|----------------------------------------+--------------+-------------|
| combSort13() | 4214/ 354 | 154/ 0 |
| combSort13m() | 4232/ 354 | 172/ 0 |
| combSort133() | 4166/ 354 | 106/ 0 |
| combSort133m() | 4188/ 354 | 128/ 0 |
|----------------------------------------+--------------+-------------|
| quickSortMiddle() | 4238/ 354 | 178/ 0 |
| quickSortMedian() | 4290/ 354 | 230/ 0 |
| quickSortMedianSwapped() | 4336/ 354 | 276/ 0 |
|----------------------------------------+--------------+-------------|
| qsort() | 5144/ 354 | 1084/ 0 |
+---------------------------------------------------------------------+
- 48 MHz ARM Cortex-M0+
- Arduino 1.8.16, Arduino CLI 0.19.2
- Sparkfun SAMD Boards 1.8.4
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| Baseline | 10584/ 0 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| bubbleSort() | 10624/ 0 | 40/ 0 |
| insertionSort() | 10632/ 0 | 48/ 0 |
| selectionSort() | 10648/ 0 | 64/ 0 |
|----------------------------------------+--------------+-------------|
| shellSortClassic() | 10648/ 0 | 64/ 0 |
| shellSortKnuth() | 10640/ 0 | 56/ 0 |
| shellSortTokuda() | 10704/ 0 | 120/ 0 |
|----------------------------------------+--------------+-------------|
| combSort13() | 10648/ 0 | 64/ 0 |
| combSort13m() | 10664/ 0 | 80/ 0 |
| combSort133() | 10640/ 0 | 56/ 0 |
| combSort133m() | 10656/ 0 | 72/ 0 |
|----------------------------------------+--------------+-------------|
| quickSortMiddle() | 10680/ 0 | 96/ 0 |
| quickSortMedian() | 10712/ 0 | 128/ 0 |
| quickSortMedianSwapped() | 10728/ 0 | 144/ 0 |
|----------------------------------------+--------------+-------------|
| qsort() | 11384/ 0 | 800/ 0 |
+---------------------------------------------------------------------+
(SAMD compiler does not produce RAM usage numbers.)
- STM32F103C8, 72 MHz ARM Cortex-M3
- Arduino 1.8.16, Arduino CLI 0.19.2
- STM32duino 2.0.0
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| Baseline | 26820/ 3844 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| bubbleSort() | 26856/ 3844 | 36/ 0 |
| insertionSort() | 26864/ 3844 | 44/ 0 |
| selectionSort() | 26900/ 3844 | 80/ 0 |
|----------------------------------------+--------------+-------------|
| shellSortClassic() | 26884/ 3844 | 64/ 0 |
| shellSortKnuth() | 26900/ 3844 | 80/ 0 |
| shellSortTokuda() | 26944/ 3844 | 124/ 0 |
|----------------------------------------+--------------+-------------|
| combSort13() | 26896/ 3844 | 76/ 0 |
| combSort13m() | 26904/ 3844 | 84/ 0 |
| combSort133() | 26888/ 3844 | 68/ 0 |
| combSort133m() | 26896/ 3844 | 76/ 0 |
|----------------------------------------+--------------+-------------|
| quickSortMiddle() | 26920/ 3844 | 100/ 0 |
| quickSortMedian() | 26952/ 3844 | 132/ 0 |
| quickSortMedianSwapped() | 26976/ 3844 | 156/ 0 |
|----------------------------------------+--------------+-------------|
| qsort() | 27652/ 3844 | 832/ 0 |
+---------------------------------------------------------------------+
- NodeMCU 1.0, 80MHz ESP8266
- Arduino 1.8.16, Arduino CLI 0.19.2
- ESP8266 Boards 3.0.2
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| Baseline | 260497/28108 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| bubbleSort() | 260545/28108 | 48/ 0 |
| insertionSort() | 260545/28108 | 48/ 0 |
| selectionSort() | 260561/28108 | 64/ 0 |
|----------------------------------------+--------------+-------------|
| shellSortClassic() | 260577/28108 | 80/ 0 |
| shellSortKnuth() | 260577/28108 | 80/ 0 |
| shellSortTokuda() | 260637/28128 | 140/ 20 |
|----------------------------------------+--------------+-------------|
| combSort13() | 260609/28108 | 112/ 0 |
| combSort13m() | 260625/28108 | 128/ 0 |
| combSort133() | 260593/28108 | 96/ 0 |
| combSort133m() | 260609/28108 | 112/ 0 |
|----------------------------------------+--------------+-------------|
| quickSortMiddle() | 260641/28108 | 144/ 0 |
| quickSortMedian() | 260673/28108 | 176/ 0 |
| quickSortMedianSwapped() | 260689/28108 | 192/ 0 |
|----------------------------------------+--------------+-------------|
| qsort() | 261617/28108 | 1120/ 0 |
+---------------------------------------------------------------------+
- ESP32-01 Dev Board, 240 MHz Tensilica LX6
- Arduino 1.8.16, Arduino CLI 0.19.2
- ESP32 Boards 1.0.6
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| Baseline | 197996/13284 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| bubbleSort() | 198040/13284 | 44/ 0 |
| insertionSort() | 198072/13284 | 76/ 0 |
| selectionSort() | 198072/13284 | 76/ 0 |
|----------------------------------------+--------------+-------------|
| shellSortClassic() | 198072/13284 | 76/ 0 |
| shellSortKnuth() | 198084/13284 | 88/ 0 |
| shellSortTokuda() | 198152/13284 | 156/ 0 |
|----------------------------------------+--------------+-------------|
| combSort13() | 198100/13284 | 104/ 0 |
| combSort13m() | 198112/13284 | 116/ 0 |
| combSort133() | 198080/13284 | 84/ 0 |
| combSort133m() | 198092/13284 | 96/ 0 |
|----------------------------------------+--------------+-------------|
| quickSortMiddle() | 198112/13284 | 116/ 0 |
| quickSortMedian() | 198140/13284 | 144/ 0 |
| quickSortMedianSwapped() | 198172/13284 | 176/ 0 |
|----------------------------------------+--------------+-------------|
| qsort() | 198088/13284 | 92/ 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 1.8.16, Arduino CLI 0.19.2
- Teensyduino 1.55
+---------------------------------------------------------------------+
| Functionality | flash/ ram | delta |
|----------------------------------------+--------------+-------------|
| Baseline | 7124/ 3256 | 0/ 0 |
|----------------------------------------+--------------+-------------|
| bubbleSort() | 7156/ 3256 | 32/ 0 |
| insertionSort() | 7180/ 3256 | 56/ 0 |
| selectionSort() | 7188/ 3256 | 64/ 0 |
|----------------------------------------+--------------+-------------|
| shellSortClassic() | 7204/ 3256 | 80/ 0 |
| shellSortKnuth() | 7216/ 3256 | 92/ 0 |
| shellSortTokuda() | 7292/ 3256 | 168/ 0 |
|----------------------------------------+--------------+-------------|
| combSort13() | 7200/ 3256 | 76/ 0 |
| combSort13m() | 7212/ 3256 | 88/ 0 |
| combSort133() | 7180/ 3256 | 56/ 0 |
| combSort133m() | 7196/ 3256 | 72/ 0 |
|----------------------------------------+--------------+-------------|
| quickSortMiddle() | 7232/ 3256 | 108/ 0 |
| quickSortMedian() | 7268/ 3256 | 144/ 0 |
| quickSortMedianSwapped() | 7296/ 3256 | 172/ 0 |
|----------------------------------------+--------------+-------------|
| qsort() | 8584/ 3256 | 1460/ 0 |
+---------------------------------------------------------------------+