Closed aykevl closed 1 day ago
Size difference with the dev branch:
not the same command! tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/adafruit4650 go: downloading tinygo.org/x/tinyfont v0.3.0 not the same command! tinygo build -size short -o ./build/test.hex -target=nano-rp2040 -stack-size 8kb ./examples/net/websocket/dial/ go: downloading golang.org/x/net v0.7.0 not the same command! tinygo build -size short -o ./build/test.hex -target=nano-rp2040 -stack-size 8kb ./examples/net/mqttclient/natiu/ go: downloading github.com/soypat/natiu-mqtt v0.5.1 not the same command! tinygo build -size short -o ./build/test.hex -target=wioterminal -stack-size 8kb ./examples/net/mqttclient/paho/ go: downloading github.com/eclipse/paho.mqtt.golang v1.2.0 flash ram before after diff before after diff 26452 26136 -316 -1.19% 16732 16412 -320 -1.91% tinygo build -size short -o ./build/test.hex -target=pico ./examples/waveshare-epd/epd2in66b/main.go 24728 24564 -164 -0.66% 13892 13720 -172 -1.24% tinygo build -size short -o ./build/test.hex -target=feather-nrf52840-sense ./examples/waveshare-epd/epd1in54/main.go 16864 16712 -152 -0.90% 4324 4172 -152 -3.52% tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/adafruit4650 338452 338412 -40 -0.01% 15396 15380 -16 -0.10% tinygo build -size short -o ./build/test.hex -target=matrixportal-m4 -stack-size 8kb ./examples/net/webstatic/ 9796 9760 -36 -0.37% 4768 4752 -16 -0.34% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/apa102/itsybitsy-m0/main.go 65612 65580 -32 -0.05% 9012 9004 -8 -0.09% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/flash/console/qspi 263676 263656 -20 -0.01% 46760 46748 -12 -0.03% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/slideshow 9328 9308 -20 -0.21% 5260 5240 -20 -0.38% tinygo build -size short -o ./build/test.hex -target=nucleo-l432kc ./examples/aht20/main.go 61432 61416 -16 -0.03% 6196 6180 -16 -0.26% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/adt7410/main.go 75856 75840 -16 -0.02% 7480 7456 -24 -0.32% tinygo build -size short -o ./build/test.hex -target=p1am-100 ./examples/p1am/main.go 119360 119344 -16 -0.01% 7848 7840 -8 -0.10% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 -stack-size 8kb ./examples/net/tcpclient/ 13740 13728 -12 -0.09% 4940 4928 -12 -0.24% tinygo build -size short -o ./build/test.hex -target=nucleo-wl55jc ./examples/sx126x/lora_rxtx/ 83168 83156 -12 -0.01% 6588 6576 -12 -0.18% tinygo build -size short -o ./build/test.hex -target=nucleo-wl55jc ./examples/lora/lorawan/atcmd/ 287108 287096 -12 -0.00% 18212 18200 -12 -0.07% tinygo build -size short -o ./build/test.hex -target=wioterminal -stack-size 8kb ./examples/net/mqttclient/paho/ 69256 69248 -8 -0.01% 6976 6968 -8 -0.11% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/flash/console/spi 8180 8176 -4 -0.05% 3348 3344 -4 -0.12% tinygo build -size short -o ./build/test.hex -target=bluepill ./examples/ds1307/sram/main.go 22168 22164 -4 -0.02% 3544 3540 -4 -0.11% tinygo build -size short -o ./build/test.hex -target=bluepill ./examples/ds1307/time/main.go 10068 10064 -4 -0.04% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/tm1637/main.go 7336 7332 -4 -0.05% 3320 3316 -4 -0.12% tinygo build -size short -o ./build/test.hex -target=nucleo-f103rb ./examples/shiftregister/main.go 8880 8876 -4 -0.05% 4764 4756 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/max72xx/main.go 9568 9568 0 0.00% 4756 4748 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/adxl345/main.go 13564 13564 0 0.00% 6796 6788 -8 -0.12% tinygo build -size short -o ./build/test.hex -target=pybadge ./examples/amg88xx 8680 8680 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/apa102/main.go 11828 11828 0 0.00% 6580 6580 0 0.00% tinygo build -size short -o ./build/test.hex -target=nano-33-ble ./examples/apds9960/proximity/main.go 8368 8368 0 0.00% 2320 2320 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/at24cx/main.go 8124 8124 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bh1750/main.go 7432 7432 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/blinkm/main.go 70576 70576 0 0.00% 3660 3660 0 0.00% tinygo build -size short -o ./build/test.hex -target=pinetime ./examples/bma42x/main.go 63956 63956 0 0.00% 6196 6196 0 0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmi160/main.go 27412 27412 0 0.00% 4788 4780 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmp180/main.go 64008 64008 0 0.00% 6228 6228 0 0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/bmp280/main.go 12200 12200 0 0.00% 4820 4812 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/bmp388/main.go 69712 69712 0 0.00% 6376 6368 -8 -0.13% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/ds3231/main.go 4620 4620 0 0.00% 2280 2280 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/easystepper/main.go 7212 7212 0 0.00% 2280 2280 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/gc9a01/main.go 67580 67580 0 0.00% 6368 6360 -8 -0.13% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/gps/i2c/main.go 7872 7872 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/hcsr04/main.go 5832 5832 0 0.00% 2280 2280 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hd44780/customchar/main.go 5784 5784 0 0.00% 2280 2280 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hd44780/text/main.go 10528 10528 0 0.00% 4756 4748 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/hd44780i2c/main.go 14752 14752 0 0.00% 6580 6580 0 0.00% tinygo build -size short -o ./build/test.hex -target=nano-33-ble ./examples/hts221/main.go 16148 16148 0 0.00% 2360 2360 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/hub75/main.go 10152 10152 0 0.00% 6916 6916 0 0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/basic 10644 10644 0 0.00% 4868 4868 0 0.00% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/ili9341/basic 29504 29504 0 0.00% 38076 38076 0 0.00% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/pyportal_boing 10172 10172 0 0.00% 6924 6916 -8 -0.12% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/ili9341/scroll 10732 10732 0 0.00% 4876 4868 -8 -0.16% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/ili9341/scroll 11732 11732 0 0.00% 4788 4780 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/lis3dh/main.go 14096 14096 0 0.00% 6580 6580 0 0.00% tinygo build -size short -o ./build/test.hex -target=nano-33-ble ./examples/lps22hb/main.go 26132 26132 0 0.00% 2328 2328 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/lsm303agr/main.go 12448 12448 0 0.00% 4796 4788 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/lsm6ds3/main.go 10744 10744 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mag3110/main.go 9916 9916 0 0.00% 4780 4780 0 0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp23017/main.go 10368 10368 0 0.00% 4788 4788 0 0.00% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp23017-multiple/main.go 9780 9780 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp3008/main.go 68600 68600 0 0.00% 6196 6188 -8 -0.13% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mcp2515/main.go 8240 8240 0 0.00% 4756 4748 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mma8653/main.go 8148 8148 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/mpu6050/main.go 12252 12252 0 0.00% 3352 3352 0 0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/pca9685/main.go 6228 6228 0 0.00% 3288 3288 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/pcd8544/setbuffer/main.go 5260 5260 0 0.00% 2280 2280 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/pcd8544/setpixel/main.go 10536 10536 0 0.00% 3328 3328 0 0.00% tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/seesaw 2825 2825 0 0.00% 558 558 0 0.00% tinygo build -size short -o ./build/test.hex -target=arduino ./examples/servo 13768 13768 0 0.00% 3400 3400 0 0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/sgp30 8080 8080 0 0.00% 6796 6788 -8 -0.12% tinygo build -size short -o ./build/test.hex -target=pybadge ./examples/shifter/main.go 57412 57412 0 0.00% 3692 3684 -8 -0.22% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/sht3x/main.go 57468 57468 0 0.00% 3700 3692 -8 -0.22% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/sht4x/main.go 57376 57376 0 0.00% 3692 3684 -8 -0.22% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/shtc3/main.go 6688 6688 0 0.00% 2288 2288 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1306/i2c_128x32/main.go 6140 6140 0 0.00% 2280 2280 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1306/spi_128x64/main.go 5844 5844 0 0.00% 2280 2280 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ssd1331/main.go 6784 6784 0 0.00% 2280 2280 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/st7735/main.go 6696 6696 0 0.00% 2280 2280 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/st7789/main.go 16964 16964 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/thermistor/main.go 10548 10548 0 0.00% 4540 4540 0 0.00% tinygo build -size short -o ./build/test.hex -target=circuitplay-bluefruit ./examples/tone 10868 10868 0 0.00% 3340 3340 0 0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/touch/capacitive 9520 9520 0 0.00% 6788 6780 -8 -0.12% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/touch/resistive/fourwire/main.go 14980 14980 0 0.00% 4756 4748 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/vl53l1x/main.go 13460 13460 0 0.00% 4756 4748 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=itsybitsy-m0 ./examples/vl6180x/main.go 6488 6488 0 0.00% 2320 2320 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd2in13/main.go 6176 6176 0 0.00% 2312 2312 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd2in13x/main.go 6400 6400 0 0.00% 2320 2320 0 0.00% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/waveshare-epd/epd4in2/main.go 6848 6848 0 0.00% 4788 4780 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/ws2812 5764 5764 0 0.00% 9538 9522 -16 -0.17% tinygo build -size short -o ./build/test.bin -target=m5stamp-c3 ./examples/ws2812 62468 62468 0 0.00% 5952 5952 0 0.00% tinygo build -size short -o ./build/test.hex -target=feather-nrf52840 ./examples/is31fl3731/main.go 1581 1581 0 0.00% 598 598 0 0.00% tinygo build -size short -o ./build/test.hex -target=arduino ./examples/ws2812 1056 1056 0 0.00% 180 180 0 0.00% tinygo build -size short -o ./build/test.hex -target=digispark ./examples/ws2812 31856 31856 0 0.00% 4788 4780 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/bme280/main.go 16436 16436 0 0.00% 4732 4724 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/microphone/main.go 11080 11080 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/buzzer/main.go 12788 12788 0 0.00% 4788 4780 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=trinket-m0 ./examples/veml6070/main.go 6752 6752 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l293x/simple/main.go 8664 8664 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l293x/speed/main.go 6720 6720 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l9110x/simple/main.go 9276 9276 0 0.00% 4756 4748 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/l9110x/speed/main.go 7012 7012 0 0.00% 2268 2268 0 0.00% tinygo build -size short -o ./build/test.hex -target=hifive1b ./examples/ssd1351/main.go 13004 13004 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=circuitplay-express ./examples/lis2mdl/main.go 77292 77292 0 0.00% 6344 6336 -8 -0.13% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/dht/main.go 71320 71320 0 0.00% 6344 6336 -8 -0.13% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/alarm/ 7276 7276 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/clkout/ 71280 71280 0 0.00% 6352 6344 -8 -0.13% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/timer/ 12184 12184 0 0.00% 3304 3304 0 0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/qmi8658c/main.go 10808 10808 0 0.00% 3288 3288 0 0.00% tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/pcf8591/ 8744 8744 0 0.00% 4756 4748 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/ina260/main.go 13196 13196 0 0.00% 4788 4780 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/ina219/main.go 72700 72700 0 0.00% 10748 10748 0 0.00% tinygo build -size short -o ./build/test.hex -target=feather-m4 ./examples/sdcard/console/ 61544 61544 0 0.00% 8232 8232 0 0.00% tinygo build -size short -o ./build/test.hex -target=feather-m4 ./examples/i2csoft/adt7410/ 10296 10296 0 0.00% 6796 6788 -8 -0.12% tinygo build -size short -o ./build/test.elf -target=wioterminal ./examples/axp192/m5stack-core2-blinky/ 9028 9028 0 0.00% 3276 3276 0 0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/xpt2046/main.go 31352 31352 0 0.00% 4548 4548 0 0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/ssd1289/main.go 11256 11256 0 0.00% 4252 4252 0 0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/irremote/main.go 11952 11952 0 0.00% 3324 3324 0 0.00% tinygo build -size short -o ./build/test.hex -target=badger2040 ./examples/uc8151/main.go 8552 8552 0 0.00% 4748 4748 0 0.00% tinygo build -size short -o ./build/test.uf2 -target=circuitplay-express ./examples/makeybutton/main.go 9664 9664 0 0.00% 4772 4764 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/ds18b20/main.go 15916 15916 0 0.00% 4880 4868 -12 -0.25% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/as560x/main.go 9888 9888 0 0.00% 3296 3296 0 0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/mpu6886/main.go 7808 7808 0 0.00% 4748 4740 -8 -0.17% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/ttp229/main.go 66856 66856 0 0.00% 4816 4816 0 0.00% tinygo build -size short -o ./build/test.hex -target=pico ./examples/ndir/main_ndir.go 62300 62300 0 0.00% 3788 3780 -8 -0.21% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/ndir/main_ndir.go 65284 65284 0 0.00% 6260 6252 -8 -0.13% tinygo build -size short -o ./build/test.hex -target=arduino-nano33 ./examples/ndir/main_ndir.go 9316 9316 0 0.00% 3288 3288 0 0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/mpu9150/main.go 11396 11396 0 0.00% 3324 3324 0 0.00% tinygo build -size short -o ./build/test.hex -target=macropad-rp2040 ./examples/sh1106/macropad_spi 8456 8456 0 0.00% 3760 3760 0 0.00% tinygo build -size short -o ./build/test.hex -target=macropad-rp2040 ./examples/encoders/quadrature-interrupt 65832 65832 0 0.00% 4784 4784 0 0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/mcp9808/main.go 296620 296620 0 0.00% 13788 13784 -4 -0.03% tinygo build -size short -o ./build/test.hex -target=pyportal -stack-size 8kb ./examples/net/http-get/ 245500 245500 0 0.00% 10488 10484 -4 -0.04% tinygo build -size short -o ./build/test.hex -target=nano-rp2040 -stack-size 8kb ./examples/net/websocket/dial/ 111572 111572 0 0.00% 7772 7772 0 0.00% tinygo build -size short -o ./build/test.hex -target=arduino-mkrwifi1010 -stack-size 8kb ./examples/net/tlsclient/ 154224 154224 0 0.00% 6540 6540 0 0.00% tinygo build -size short -o ./build/test.hex -target=nano-rp2040 -stack-size 8kb ./examples/net/mqttclient/natiu/ 27260 27264 4 0.01% 3648 3640 -8 -0.22% tinygo build -size short -o ./build/test.hex -target=microbit ./examples/microbitmatrix/main.go 26972 26976 4 0.01% 5696 5688 -8 -0.14% tinygo build -size short -o ./build/test.hex -target=microbit-v2 ./examples/microbitmatrix/main.go 12588 12592 4 0.03% 6984 6976 -8 -0.11% tinygo build -size short -o ./build/test.hex -target=pyportal ./examples/touch/resistive/pyportal_touchpaint/main.go 36532 36536 4 0.01% 3988 3988 0 0.00% tinygo build -size short -o ./build/test.hex -target=feather-rp2040 ./examples/pcf8523/ 68108 68116 8 0.01% 6504 6504 0 0.00% tinygo build -size short -o ./build/test.hex -target=feather-m0 ./examples/gps/uart/main.go 70848 70856 8 0.01% 6340 6332 -8 -0.13% tinygo build -size short -o ./build/test.hex -target=xiao ./examples/pcf8563/time/ 10428 10436 8 0.08% 3356 3356 0 0.00% tinygo build -size short -o ./build/test.uf2 -target=pico ./examples/scd4x/main.go 85924 85932 8 0.01% 5140 5140 0 0.00% tinygo build -size short -o ./build/test.hex -target=challenger-rp2040 ./examples/net/ntpclient/ 103112 103120 8 0.01% 9816 9816 0 0.00% tinygo build -size short -o ./build/test.hex -target=metro-m4-airlift -stack-size 8kb ./examples/net/socket/ 117056 117064 8 0.01% 13132 13132 0 0.00% tinygo build -size short -o ./build/test.hex -target=wioterminal -stack-size 8kb ./examples/net/webclient/ 286096 286108 12 0.00% 17812 17808 -4 -0.02% tinygo build -size short -o ./build/test.hex -target=wioterminal -stack-size 8kb ./examples/net/webserver/ 5333026 5332210 -816 -0.00% 811790 810490 -1300 -0.00%
This does indeed reduce SRAM and flash usage slightly in many cases (see the "size difference" comment above).
Thanks @aykevl now merging.
Use the alignment from the align attribute of the runtime.alloc call. This is going to be a more accurate alignment, and is typically smaller than the default.
This also reduces binary size and static RAM usage slightly in some cases.