#!/usr/bin/env bash # # Stats about build artifacts. # # Usage: # ./stats.sh set -o nounset set -o pipefail set -o errexit # TODO: Track these metrics over time. # hello: 1.41 MB native + 145 KB = 1.56 MB bundle # oil: 1.65 MB native + 642 KB = 2.30 MB bundle proc bundle-size { ls -l _build/*/bytecode.zip _build/*/ovm _bin/*.ovm } proc linecount-nativedeps { var app_name = $(1:-oil) find _tmp/$app_name-tar-test -name '*.[ch]' | xargs wc -l | sort -n } proc linecount-pydeps { var app_name = $(1:-oil) awk '/\.py$/ { print $1 }' \ _build/runpy-deps-py.txt _build/$app_name/app-deps-py.txt | sort | uniq | xargs wc -l | sort -n } proc _tar-lines { linecount-nativedeps @Argv echo linecount-pydeps @Argv } # 144.6 K lines of C # 6.4 K lines Python. proc hello-tar-lines { _tar-lines hello } # 165.8 K lines of C (biggest: posixmodule.c, unicodeobject.c) # 30.8 K lines Python (biggest: proc oil-tar-lines { _tar-lines oil } @Argv (CommandList children: [ (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (C {(set)} {(-o)} {(errexit)}) (FuncDef name: bundle-size body: (BraceGroup children: [ (C {(ls)} {(-l)} {(_build/) (Lit_Other "*") (/bytecode.zip)} {(_build/) (Lit_Other "*") (/ovm)} {(_bin/) (Lit_Other "*") (.ovm)} ) ] spids: [52] ) spids: [48 51] ) (FuncDef name: linecount-nativedeps body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:app_name) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(oil)}) spids: [84 88] ) } spids: [83] ) ] spids: [81] ) (Pipeline children: [ (C {(find)} {(_tmp/) ($ VSub_Name "$app_name") (-tar-test)} {(-name)} {(SQ <"*.[ch]">)}) (C {(xargs)} {(wc)} {(-l)}) (C {(sort)} {(-n)}) ] negated: False ) ] spids: [78] ) spids: [74 77] ) (FuncDef name: linecount-pydeps body: (BraceGroup children: [ (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:app_name) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(oil)}) spids: [130 134] ) } spids: [129] ) ] spids: [127] ) (Pipeline children: [ (C {(awk)} {(SQ <"/\\.py$/ { print $1 }">)} {(_build/runpy-deps-py.txt)} {(_build/) ($ VSub_Name "$app_name") (/app-deps-py.txt)} ) (C {(sort)}) (C {(uniq)}) (C {(xargs)} {(wc)} {(-l)}) (C {(sort)} {(-n)}) ] negated: False ) ] spids: [124] ) spids: [120 123] ) (FuncDef name: _tar-lines body: (BraceGroup children: [ (C {(linecount-nativedeps)} {(DQ ($ VSub_At "$@"))}) (C {(echo)}) (C {(linecount-pydeps)} {(DQ ($ VSub_At "$@"))}) ] spids: [181] ) spids: [177 180] ) (FuncDef name: hello-tar-lines body: (BraceGroup children:[(C {(_tar-lines)} {(hello)})] spids:[213]) spids: [209 212] ) (FuncDef name: oil-tar-lines body: (BraceGroup children:[(C {(_tar-lines)} {(oil)})] spids:[233]) spids: [229 232] ) (C {(DQ ($ VSub_At "$@"))}) ] )