diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-12-06 01:12:08 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-12-06 01:12:08 -0800 |
commit | 68719bebc02ca355aa96dee2497f511d24606fc8 (patch) | |
tree | 4f279ad52a1f83e386672b81eeb1f95e4ae9d692 /treeshake_all | |
parent | b6d62cc91c144ad15a2d8361a95be99b1003c5ae (diff) | |
download | mu-68719bebc02ca355aa96dee2497f511d24606fc8.tar.gz |
5794
Rather surprisingly, all the treeshake tooling is done in just about 2 hours of work. From now on it'll be easier to update stats.txt. Observations: a) Binaries are tiny compared to conventional stacks. Tens of KB. b) ~80% of binaries are tests and unused libraries in all my apps. c) ~75% of LoC in SubX sources are tests or comments.
Diffstat (limited to 'treeshake_all')
-rwxr-xr-x | treeshake_all | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/treeshake_all b/treeshake_all index 2a13f50a..8ebf51d0 100755 --- a/treeshake_all +++ b/treeshake_all @@ -9,38 +9,34 @@ cd `dirname $0` export OS=${OS:-linux} -for app in factorial crenshaw2-1 crenshaw2-1b +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 - ./treeshake_translate init.$OS 0*.subx apps/$app.subx + ./treeshake_translate init.$OS 0*.subx apps/subx-params.subx apps/$app.subx 2> apps/$app.stderr + 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 |./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 - apps/$app test - echo - apps/$app.treeshake.bin test - echo + echo "binary size: `ls -lh apps/$app |column 5` => `ls -lh apps/$app.treeshake.bin |column 5`" done -# Phases of the self-hosted SubX translator. +echo "== testing treeshaken binaries" +for app in factorial crenshaw2-1 crenshaw2-1b +do + echo $app + ./treeshake_ntranslate init.$OS 0*.subx apps/$app.subx + diff apps/$app a.elf +done for app in hex survey pack assort dquotes tests sigils calls braces do echo $app - ./treeshake_translate init.$OS 0*.subx apps/subx-params.subx apps/$app.subx - mv a.treeshake apps/$app.treeshake - mv a.elf apps/$app.treeshake.bin - apps/$app test - echo - apps/$app.treeshake.bin test - echo + ./treeshake_ntranslate init.$OS 0*.subx apps/subx-params.subx apps/$app.subx + diff apps/$app a.elf done -# Mu translator echo mu.subx -./treeshake_translate init.$OS 0*.subx apps/mu.subx -mv a.treeshake apps/mu.treeshake -mv a.elf apps/mu.treeshake.bin -apps/mu test -echo -apps/mu.treeshake.bin test -echo +./treeshake_ntranslate init.$OS 0*.subx apps/mu.subx +diff apps/mu a.elf |