diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-09 18:34:20 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-09 18:34:20 +0100 |
| commit | 26915d8c47260f90d67df8c6af1f16ba7607a3d5 (patch) | |
| tree | c01f1e6bfe0cb85a27f5fc94ed01dea7aa9b969e /scripts | |
| parent | 82fcfd2656a9f7085c54407d9c390a7d413c4b5a (diff) | |
feat: Implement Task #76 external library size measurement
- Use ma_backend_null for audio (100-200KB savings)
- Stub platform/gpu abstractions instead of external APIs
- Add DEMO_STRIP_EXTERNAL_LIBS build mode
- Create stub_types.h with minimal WebGPU opaque types
- Add scripts/measure_size.sh for automated measurement
Results: Demo=4.4MB, External=2.0MB (69% vs 31%)
handoff(Claude): Task #76 complete. Binary compiles but doesn't run (size measurement only).
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/measure_size.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/scripts/measure_size.sh b/scripts/measure_size.sh new file mode 100755 index 0000000..51c773f --- /dev/null +++ b/scripts/measure_size.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Measures core demo size by building with STRIP_EXTERNAL_LIBS +# Binary compiles but does NOT run (all I/O stubbed) + +set -e + +echo "=== Demo Size Measurement ===" +echo "" + +# Clean previous build +rm -rf build_size + +# Build with STRIP_EXTERNAL_LIBS +echo "Building with STRIP_EXTERNAL_LIBS..." +cmake -S . -B build_size -DDEMO_STRIP_EXTERNAL_LIBS=ON +cmake --build build_size -j4 + +# Strip debug symbols +strip build_size/demo64k + +# Measure sizes +echo "" +echo "=== Size Results ===" +echo "" + +DEMO_SIZE=$(stat -f%z build_size/demo64k 2>/dev/null || stat -c%s build_size/demo64k) +DEMO_SIZE_KB=$((DEMO_SIZE / 1024)) + +echo "Demo code only: ${DEMO_SIZE_KB} KB (${DEMO_SIZE} bytes)" + +# Compare with normal build if it exists +if [ -f build/demo64k ]; then + NORMAL_SIZE=$(stat -f%z build/demo64k 2>/dev/null || stat -c%s build/demo64k) + NORMAL_SIZE_KB=$((NORMAL_SIZE / 1024)) + EXTERNAL_SIZE=$((NORMAL_SIZE - DEMO_SIZE)) + EXTERNAL_SIZE_KB=$((EXTERNAL_SIZE / 1024)) + + echo "" + echo "Normal build: ${NORMAL_SIZE_KB} KB (${NORMAL_SIZE} bytes)" + echo "External libs: ${EXTERNAL_SIZE_KB} KB (${EXTERNAL_SIZE} bytes)" + echo "" + echo "Demo is $(echo "scale=1; $DEMO_SIZE * 100 / $NORMAL_SIZE" | bc)% of total size" +fi + +echo "" +echo "Note: Size measurement binary does NOT run (all I/O stubbed)" |
