Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code size differences from 2.5.0 to 2.6.0-dev head #6163

Closed
earlephilhower opened this issue May 29, 2019 · 4 comments
Closed

Code size differences from 2.5.0 to 2.6.0-dev head #6163

earlephilhower opened this issue May 29, 2019 · 4 comments
Assignees

Comments

@earlephilhower
Copy link
Collaborator

I ran s quick test building everything under 2.5.0 and my current git (which happened to be 758ad32 which is the remove-all-SSL-constants-from RAM PR).

On average we're significantly better in free heap and IRAM, but code size is a mixed result with SD stuff taking much more ROM and http updater taking more too.

Attached is the ODS sheet. I don't trust the color formatting to work if I save it to XLSX format.

2.5.0 vs 2.6.0-dev code size.zip

@earlephilhower
Copy link
Collaborator Author

Some interesting results averaged over all examples:
. 2.6.0-dev save an average of 140 bytes of BSS and 480 bytes of RODATA. So apps have an average of ~600 bytes more free heap with no changes.
. IRAM is very bimodal. Either we save ~200 bytes or we have an extra *500 bytes used. Looks like a common routine used by some examples grew a lot
. WiFi/HTTP apps seem to have grown by ~2K, but without them everything's shrunk by ~500 bytes.

@earlephilhower
Copy link
Collaborator Author

#!/bin/bash
export ARDUINO_IDE_PATH=/usr/local/bin/arduino-1.8.8
export BUILDDIR=/tmp/build-sizer
export CACHEDIR=/tmp/build-sizer.cache
mkdir -p "$BUILDDIR" "$CACHEDIR"
export REPO=/home/$USER/Arduino/hardware/esp8266com/esp8266
INOS=$(find "$REPO/libraries" -name "*.ino" | grep -v ESP8266SdFat | grep -v tests)
echo "SKETCH IROM IRAM DATA RODATA BSS"
for INO in $INOS; do
  "$ARDUINO_IDE_PATH/arduino-builder" -compile -logger=human \
    -build-path "$BUILDDIR" -tools $ARDUINO_IDE_PATH/tools-builder \
    -hardware "$ARDUINO_IDE_PATH/hardware" \
    -hardware "$REPO/../../" -build-cache $CACHEDIR \
    -fqbn=esp8266com:esp8266:generic:xtal=80,FlashFreq=40,FlashMode=qio,baud=921600,eesz=4M1M,ip=lm2f,ResetMethod=nodemcu \
    -ide-version=10607 -warnings=none $INO >& /dev/null
  IROM=$(size -A "$BUILDDIR"/$(basename "$INO").elf | grep "^\.irom0\.text\s" | awk '{print $2}')
  IRAM=$(size -A "$BUILDDIR"/$(basename "$INO").elf | grep "^\.text\s" | awk '{print $2}')
  IRAM1=$(size -A "$BUILDDIR"/$(basename "$INO").elf | grep "^\.text1\s" | awk '{print $2}')
  DATA=$(size -A "$BUILDDIR"/$(basename "$INO").elf | grep "^\.data\s" | awk '{print $2}')
  RODATA=$(size -A "$BUILDDIR"/$(basename "$INO").elf | grep "^\.rodata\s" | awk '{print $2}')
  BSS=$(size -A "$BUILDDIR"/$(basename "$INO").elf | grep "^\.bss\s" | awk '{print $2}')
  echo $(basename "$INO") $IROM $(echo $IRAM + 0$IRAM1 | bc) $DATA $RODATA $BSS
done

@earlephilhower
Copy link
Collaborator Author

#6326, or its children, should fix the IRAM growth of ~500bytes when doing I2C and get us back to 2.5.0 sizes there or better.

The PROGMEM difference I see most is in SDFAT, and that is due to the ::format method which did NOT exist prior to the SD/SDFAT/SPIFFS unification. If 12KB is an issue, we would need to find a way to conditionally compile the ::format method.

Factoring those out, the only other outlier is httpUpdateSigned which has grown by 40KB. Needs looking at to see what's going on there.

Otherwise the average is an PROGMEM growth of <1KB, which I consider noise at this time...

@earlephilhower
Copy link
Collaborator Author

After the I2C changes, IRAM is use has gone down a lot, removing the main issue. Individual tracking can be done in specific issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants