Skip to content

Commit

Permalink
[performance] Sharp sed hack to make Token 16 bytes instead of 24.
Browse files Browse the repository at this point in the history
$ _bin/osh_parse.opt -n benchmarks/testdata/configure-coreutils

BEFORE:

dumb_alloc:
        gNumNew = 3492038
        gNumDelete = 189920
        gMemPos = 77177720

AFTER:

dumb_alloc:
        gNumNew = 3492038
        gNumDelete = 189920
        gMemPos = 74281392
  • Loading branch information
Andy Chu committed Dec 12, 2019
1 parent 49ade56 commit e91ae61
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion build/dev.sh
Expand Up @@ -135,8 +135,19 @@ oil-asdl-to-cpp() {
# Instead of id__Eol_Tok, use Id::Eol_Tok.
# case lex_mode_e::Expr

gen-asdl-cpp frontend/syntax.asdl
gen-asdl-cpp osh/runtime.asdl

gen-asdl-cpp frontend/syntax.asdl

# CRAZY SHARP HACK to make Token 16 bytes instead of 24! (And speck is 8
# bytes rather than 12, although we might want to get rid of it.)
# Because of C's weak type system (typedef int Id_t), this is better than
# changing ASDL.
local orig=_build/cpp/syntax_asdl.h
local tmp=_devbuild/tmp/syntax_asdl.h
sed 's/Id_t id;/uint16_t id;/g' $orig > $tmp
diff -u $orig $tmp || true
mv -v $tmp $orig
}

oil-cpp() {
Expand Down

0 comments on commit e91ae61

Please sign in to comment.