summaryrefslogtreecommitdiffstatshomepage
path: root/py/stackctrl.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-10-27 18:01:25 +1100
committerDamien George <damien.p.george@gmail.com>2017-10-27 18:01:25 +1100
commitc64eb4f8ce20b025bb5762d9ce6e093d15a19dce (patch)
tree24ec8a7e48810a8b5d70e8e6bceee431fdbbef4e /py/stackctrl.c
parenta33fca99a1cc9d2026ee56e81f372c1e695379f5 (diff)
downloadmicropython-c64eb4f8ce20b025bb5762d9ce6e093d15a19dce.tar.gz
micropython-c64eb4f8ce20b025bb5762d9ce6e093d15a19dce.zip
extmod/vfs: Replace VLA in proxy func with small, static sized array.
VLAs can be expensive on stack usage due to stack alignment requirements, and also the fact that extra local variables are needed to track the dynamic size of the stack. So using fixed-size arrays when possible can help to reduce code size and stack usage. In this particular case, the maximum value of n_args in the VLA is 2 and so it's more efficient to just allocate this array with a fixed size. This reduces code size by around 30 bytes on Thumb2 and Xtensa archs. It also reduces total stack usage of the function: on Thumb2 the usage with VLA is between 40 and 48 bytes, which is reduced to 32; on Xtensa, VLA usage is between 64 and 80 bytes, reduced to 32; on x86-64 it's at least 88 bytes reduced to 80.
Diffstat (limited to 'py/stackctrl.c')
0 files changed, 0 insertions, 0 deletions