OMH4ck / PolyGlot

MIT License
35 stars 6 forks source link

Reduce memory usage by antlr #41

Closed Changochen closed 1 year ago

Changochen commented 1 year ago

Antlr will cache some data in parsing. The memory usage of parsing 200K inputs in Lua is over 50G. With this pr, the memory usage is reduced to less than 10G and the memory usage now increases slowly.

However, the memory usage of antlr is still very high. As a comparsion, the parser produced by bison takes less than 2G for over 100M times of parsing.

codecov[bot] commented 1 year ago

Codecov Report

Merging #41 (e6724e6) into main (10dde68) will increase coverage by 0.31%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #41      +/-   ##
==========================================
+ Coverage   48.17%   48.49%   +0.31%     
==========================================
  Files          16       16              
  Lines        2773     2790      +17     
==========================================
+ Hits         1336     1353      +17     
  Misses       1437     1437              
Impacted Files Coverage Δ
srcs/antlr/ir_translater.cpp 95.17% <100.00%> (+0.64%) :arrow_up:
tests/simplelang_test.cc 96.26% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more