micropython/ports/esp32/boards
Damien George 549448e8bb esp32: Enable optimisations and move code to iRAM to boost performance.
This commit enables some significant optimisations for esp32:
- move the VM to iRAM
- move hot parts of the runtime to iRAM (map lookup, load global/name,
  mp_obj_get_type)
- enable MICROPY_OPT_LOAD_ATTR_FAST_PATH
- enable MICROPY_OPT_MAP_LOOKUP_CACHE
- disable assertions
- change from -Os to -O2 for compilation

It's hard to measure performance on esp32 due to external flash and
hardware caching.  But this set of changes improves performance compared to
master by (on a TinyPICO with the GENERIC build, using IDF 4.2.2, running
at 160MHz):

diff of scores (higher is better)
N=100 M=100    esp32-master -> esp32-perf       diff      diff% (error%)
bm_chaos.py           71.28 ->     268.08 :  +196.80 = +276.094% (+/-0.04%)
bm_fannkuch.py        44.10 ->      69.31 :   +25.21 = +57.166% (+/-0.01%)
bm_fft.py           1385.27 ->    2538.23 : +1152.96 = +83.230% (+/-0.01%)
bm_float.py         1060.94 ->    3900.62 : +2839.68 = +267.657% (+/-0.03%)
bm_hexiom.py          10.90 ->      32.79 :   +21.89 = +200.826% (+/-0.02%)
bm_nqueens.py       1000.83 ->    2372.87 : +1372.04 = +137.090% (+/-0.01%)
bm_pidigits.py       288.13 ->     664.40 :  +376.27 = +130.590% (+/-0.46%)
misc_aes.py          102.45 ->     345.69 :  +243.24 = +237.423% (+/-0.01%)
misc_mandel.py      1016.58 ->    2121.92 : +1105.34 = +108.731% (+/-0.01%)
misc_pystone.py      632.91 ->    1801.87 : +1168.96 = +184.696% (+/-0.08%)
misc_raytrace.py      76.66 ->     281.78 :  +205.12 = +267.571% (+/-0.05%)
viper_call0.py       210.63 ->     273.17 :   +62.54 = +29.692% (+/-0.01%)
viper_call1a.py      208.45 ->     269.51 :   +61.06 = +29.292% (+/-0.00%)
viper_call1b.py      185.44 ->     228.25 :   +42.81 = +23.086% (+/-0.01%)
viper_call1c.py      185.86 ->     228.90 :   +43.04 = +23.157% (+/-0.01%)
viper_call2a.py      207.10 ->     267.25 :   +60.15 = +29.044% (+/-0.00%)
viper_call2b.py      173.76 ->     209.42 :   +35.66 = +20.523% (+/-0.00%)

Five tests have more than 3x speed up (200%+).

The performance of the tests bm_fft, bm_pidigits and misc_aes now scale
with CPU frequency (eg changing frequency to 240MHz boosts the performance
of these by 50%), which means they are no longer influenced by timing of
external flash access.  (The viper_call* tests did previously scale with
CPU frequency, and they still do.)

Turning off assertions reduces code size by about 80k, and going from -Os
to -O2 costs about 100k, so the net change in code size (for the GENERIC
board) is about +20k.

If a board wants to enable assertions, or use -Os instead of -O2, that's
still possible by overriding the sdkconfig parameters.

Signed-off-by: Damien George <damien@micropython.org>
2021-10-16 00:07:11 +11:00
..
ESP32_S2_WROVER esp32/boards: Add board definition for ESP32-S2-WROVER module. 2021-09-19 16:49:35 +10:00
GENERIC esp32: Restore FROZEN_MANIFEST support with new CMake build system. 2021-04-29 12:34:00 +10:00
GENERIC_C3 esp32/boards/GENERIC_C3: Add generic C3-based board. 2021-07-18 23:58:24 +10:00
GENERIC_C3_USB esp32/boards: Add GENERIC_C3_USB board with USB serial/JTAG support. 2021-08-31 00:12:41 +10:00
GENERIC_D2WD esp32: Restore FROZEN_MANIFEST support with new CMake build system. 2021-04-29 12:34:00 +10:00
GENERIC_OTA esp32: Restore FROZEN_MANIFEST support with new CMake build system. 2021-04-29 12:34:00 +10:00
GENERIC_S2 esp32: Restore FROZEN_MANIFEST support with new CMake build system. 2021-04-29 12:34:00 +10:00
GENERIC_S3 esp32/boards: Add new GENERIC_S3 board definition. 2021-09-16 22:58:47 +10:00
GENERIC_SPIRAM esp32: Restore FROZEN_MANIFEST support with new CMake build system. 2021-04-29 12:34:00 +10:00
LOLIN_S2_MINI esp32/boards: Add LOLIN_S2_MINI ESP32-S2 board. 2021-09-21 22:49:51 +10:00
M5STACK_ATOM esp32/boards: Add M5STACK_ATOM board definition. 2021-05-30 23:15:13 +10:00
SIL_WESP32 esp32/boards: Add Silicognition wESP32 board configuration. 2021-08-07 12:50:13 +10:00
UM_FEATHERS2 esp32/boards: Fix spelling mistakes in comments for UM_xxx boards. 2021-05-14 22:26:29 +10:00
UM_FEATHERS2NEO esp32/boards: Add new FeatherS2-Neo board definition. 2021-09-10 15:40:32 +10:00
UM_TINYPICO esp32/boards: Fix spelling mistakes in comments for UM_xxx boards. 2021-05-14 22:26:29 +10:00
UM_TINYS2 esp32/boards: Fix spelling mistakes in comments for UM_xxx boards. 2021-05-14 22:26:29 +10:00
manifest.py drivers/neopixel: Add common machine.bitstream-based neopixel module. 2021-08-19 22:50:32 +10:00
manifest_release.py esp8266,esp32: Update manifest to point to new dirs in micropython-lib. 2021-05-28 18:32:56 +10:00
sdkconfig.240mhz esp32: Add missing and necessary newline at EOF for sdkconfig.240mhz. 2019-10-21 23:54:59 +11:00
sdkconfig.base esp32: Enable optimisations and move code to iRAM to boost performance. 2021-10-16 00:07:11 +11:00
sdkconfig.ble esp32/boards: Remove old IDF v3 sdkconfig values. 2021-02-15 16:40:03 +11:00
sdkconfig.spiram esp32/boards: Remove old IDF v3 sdkconfig values. 2021-02-15 16:40:03 +11:00
sdkconfig.spiram_sx esp32: Extend support for S2 series, and S3 where applicable. 2021-05-10 16:56:53 +10:00
sdkconfig.usb esp32: Add support for USB with CDC ACM. 2021-04-15 10:31:06 +10:00