about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-02-09 21:12:41 -0800
committerKartik Agaram <vc@akkartik.com>2020-02-09 21:12:41 -0800
commit6a28260f199f3676b911ce0dc422d39f415b2bec (patch)
tree5a27786066934d1cefa6a0fcae635654ae0120f6
parent8fa733606c692a9dc3ff159fc4acc327573bd0e2 (diff)
downloadmu-6a28260f199f3676b911ce0dc422d39f415b2bec.tar.gz
6003
-rw-r--r--stats.txt6
-rwxr-xr-xtools/treeshake_all19
2 files changed, 18 insertions, 7 deletions
diff --git a/stats.txt b/stats.txt
index ce5f1351..22fec0f7 100644
--- a/stats.txt
+++ b/stats.txt
@@ -13,7 +13,7 @@ apps/tests.subx             284      137
 apps/sigils.subx           4641      896
 apps/calls.subx            1785      448
 apps/braces.subx            360      121
-apps/mu.subx (incomplete)  8220     2820
+apps/mu.subx (incomplete)  8554     2918
 
 ## Total source lines needed including libraries
                           Initial   -whitespace/comments/tests/dead code
@@ -30,7 +30,7 @@ apps/tests.subx            8519     2214
 apps/sigils.subx          10578     3043
 apps/calls.subx            9242     2388
 apps/braces.subx           8545     2111
-apps/mu.subx (incomplete) 13772     5048
+apps/mu.subx (incomplete) 14054     5146
 
 ## executable size in KB
                           Initial   -tests/dead code
@@ -47,4 +47,4 @@ apps/tests                  41        5.8
 apps/sigils                 54        9.1
 apps/calls                  47        7.1
 apps/braces                 42        5.9
-apps/mu (incomplete)       118       25.0
+apps/mu (incomplete)       131       26.0
diff --git a/tools/treeshake_all b/tools/treeshake_all
index 611231fe..bdf14c90 100755
--- a/tools/treeshake_all
+++ b/tools/treeshake_all
@@ -11,17 +11,28 @@ set -e
 
 export OS=${OS:-linux}
 
+process() {
+  app=$1
+  tools/treeshake_translate init.$OS 0*.subx apps/subx-params.subx apps/$app.subx
+  echo "LoC $(cat apps/$app.subx |wc -l) => $(grep -vh '^\s*$\|^\s*#' apps/$app.subx |tools/treeshake |wc -l)"
+  echo "LoC including common libraries: $(cat a.in |wc -l) => $(cat a.treeshake |wc -l)"
+  echo "binary size: $(ls -lh apps/$app |column 5) => $(ls -lh a.elf |column 5)"
+}
+
+if [ $# -gt 0 ]
+then
+  process $1
+  exit 0
+fi
+
 echo "== deleting dead code"
 for app in factorial crenshaw2-1 crenshaw2-1b handle hex survey pack dquotes assort tests sigils calls braces
 do
   echo "- $app"
-  tools/treeshake_translate init.$OS 0*.subx apps/subx-params.subx apps/$app.subx
+  process $app
   mv a.in apps/$app.in
   mv a.treeshake apps/$app.treeshake
-  echo "LoC $(cat apps/$app.subx |wc -l) => $(grep -vh '^\s*$\|^\s*#' apps/$app.subx |tools/treeshake |wc -l)"
-  echo "LoC including common libraries: $(cat apps/$app.in |wc -l) => $(cat apps/$app.treeshake |wc -l)"
   mv a.elf apps/$app.treeshake.bin
-  echo "binary size: $(ls -lh apps/$app |column 5) => $(ls -lh apps/$app.treeshake.bin |column 5)"
 done
 
 echo "== testing treeshaken binaries"