MCL icon indicating copy to clipboard operation
MCL copied to clipboard

Program Size. Investigate ways of reducing MIDICtrl size.

Open jmamma opened this issue 6 years ago • 8 comments

Currently MCL is using:

Sketch uses 203550 bytes (80%) of program storage space. Maximum is 253952 bytes.

Might want to start thinking of ways to cut this down.

A lot of the low level code is inlined. All the SYSEX Encoder/Decoder is inlined. Not sure what the space saving will be vs performance hit.

A general rule I've been following is to inline in ISR.

jmamma avatar Apr 05 '19 10:04 jmamma

Unused glyphs from the Adafruit-GFX-Library should be culled.

jmamma avatar Apr 05 '19 10:04 jmamma

Current situation:

image

yatli avatar Mar 14 '20 15:03 yatli

g=global
l=local
F=function
O=progmem

yatli avatar Mar 14 '20 15:03 yatli

So, functions are absolute heavy hitters. After the previous rounds of optimization, now the PROGMEM is only a small fraction.

yatli avatar Mar 14 '20 15:03 yatli

Tried a few tricks.

The ones that I thought would be very effective, but actually made things worse:

  • NO_INLINE some big routines
  • Fold some repeated logic by hand

The ones that I thought wouldn't matter but very effective:

  • int -> uint8_t

yatli avatar Mar 14 '20 16:03 yatli

Setting up a new branch for size optimization.

yatli avatar Mar 14 '20 16:03 yatli

#108

yatli avatar Mar 14 '20 16:03 yatli

To wrap up this thread:

  • Two attempts are made in 2020, bringing down sketch size to 78% (#108, #125)
  • As of 2021, with features are being added, it creeps back to 90% and keeps growing
  • #161 introduces compression to squeeze the last drops out of the mega2560

yatli avatar Apr 22 '21 01:04 yatli