From e346b0a2e375841c604202d892021e9c337302ef Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 24 May 2022 13:00:55 -0400 Subject: [PATCH] improve build.sh info --- build.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index e7902f9..d85161c 100755 --- a/build.sh +++ b/build.sh @@ -20,6 +20,9 @@ else exit 1 fi +pre_size=$(du -sb target/wasm32-unknown-unknown/${TYPE}/ytbn_graphing_software.wasm | awk '{ print $1 }') +echo "compiled size: $pre_size" + wasm-bindgen target/wasm32-unknown-unknown/${TYPE}/ytbn_graphing_software.wasm --out-dir pkg --target web --no-typescript if test "$TYPE" == "release"; then @@ -63,5 +66,8 @@ sed -i "s/ytbn_graphing_software.js/${new_js_name}/g" tmp/*.* +new_size=$(du -b tmp/${new_wasm_name} | awk '{ print $1 }') +diff=$(echo "scale=5 ; $new_size / $pre_size" | bc) +percent=$(echo "scale=5 ; (1-$diff)*100" | bc) echo "Total size: $(du -sb tmp)" -echo "Binary size: $(du -sb tmp/${new_wasm_name})" +echo "Binary size: $new_size reduced: $percent%"