Add more flexibility in how whitespace is specified.
[gazelle.git] / stats.sh
blobb90fcdea13763ce288b559b34d4f46a378564010
1 #!/bin/sh
3 COMPILER_LINES=`find compiler | grep lua$ | xargs cat | wc -l`
4 RUNTIME_LINES=`find runtime | grep '\.[hc]$' | xargs cat | wc -l`
5 CORE_LINES=`perl -e "print $COMPILER_LINES+$RUNTIME_LINES;"`
6 echo compiler_lines=$COMPILER_LINES
7 echo runtime_lines=$RUNTIME_LINES
8 echo core_lines=$CORE_LINES
9 echo tests_lines=`find tests | grep 'test_.*\.lua$' | xargs cat | wc -l`
10 echo docs_lines=`cat docs/manual.txt | wc -l`
12 if [ "$1" = "all" ] ; then
14 make clean > /dev/null
15 make CFLAGS="-O6 -fomit-frame-pointer -DNDEBUG -std=c99" > /dev/null
16 . ./lua_path
17 ./compiler/gzlc sketches/json.gzl
18 echo json_gzc_size=`cat sketches/json.gzc | wc -c`
19 strip runtime/libparse.a
20 echo runtime_lib_size_stripped=`cat runtime/libparse.a | wc -c`
22 rm -rf /tmp/gazelle-size-test*
23 mkdir -p /tmp/gazelle-size-test
24 git checkout-index --prefix=/tmp/gazelle-size-test/ -a
25 $(cd /tmp && tar zcf gazelle-size-test.tar.gz gazelle-size-test)
26 echo tar_gz_size=`cat /tmp/gazelle-size-test.tar.gz | wc -c`
28 LINE='"glossary":{"title":"example glossary","GlossDiv":{"title":"S","GlossList":{"GlossEntry":{"ID":"SGML","SortAs":"SGML","GlossTerm":"Standard Generalized Markup Language","Acronym":"SGML","Abbrev":"ISO 8879:1986","GlossDef":{"para":"A meta-markup language, used to create markup languages such as DocBook.","GlossSeeAlso":["GML","XML"]},"GlossSee":"markup"}}}},'
29 echo $LINE > /tmp/jsonfile
30 # TODO: let the file keep its newline once the parser can handle whitespace again
31 perl -e 'chop($str = <STDIN>); print "{" . $str x 100000 . "\"foo\":1}"' < /tmp/jsonfile > /tmp/jsonfile2
32 echo time_35MB_json=`/usr/bin/time -f "%U" ./utilities/gzlparse sketches/json.gzc /tmp/jsonfile2 2>&1`