soasme / PeppaPEG

PEG Parser in ANSI C
https://soasme.com/PeppaPEG
MIT License
55 stars 7 forks source link

Performance Optimization: reduce frame malloc by keeping unused frame. #121

Closed soasme closed 3 years ago

soasme commented 3 years ago

Given tables.go,

Before:

$ time ./cli ast --grammar-file ../tests/golang-v1.17.peg --grammar-entry SourceFile ../tables.go > /dev/null

real    0m8.478s
user    0m7.549s
sys 0m0.026s

After:

$ time ./cli ast --grammar-file ../tests/golang-v1.17.peg --grammar-entry SourceFile ../tables.go > /dev/null

real    0m4.781s
user    0m3.879s
sys 0m0.022s

Conclusion:

The change will cut down the execution time by 50%.

soasme commented 3 years ago

Relates to #119, #120