satoshinm / NetCraft

Web-based fork of fogleman/Craft ⛺
https://satoshinm.github.io/NetCraft/
MIT License
57 stars 13 forks source link

Optimize lodepng to use miniz, not its own zlib #126

Closed satoshinm closed 7 years ago

satoshinm commented 7 years ago

Reduce code duplication from https://github.com/satoshinm/NetCraft/pull/125 Add miniz 2.5.0, a zip file decompression library

miniz+lodepng lodepng using miniz delta KB
build 317 318
release-build (craft.js) 3902676 3893401 -9275 bytes -9 KB
release-build (craft.html.mem) 62992 62470 -522 -0.5 KB
wasm-build (craft.js) 1102409 1102409 0 0 KB
wasm-build (craft.wasm) 1453315 1448250 -5065 -5 KB
native-build (NetCraft-Linux.tar.gz) 2068480 2037760 -30720 - 30 KB

total change for optimized asmjs: about -10 KB, webassembly: -5 KB. Gains back some of the cost from adding miniz, but not all (+57 KB and +29 KB). Before using miniz at all, to now using lodepng with miniz, +47 KB (optimized asmjs) and +24 KB (wasm).