[PATCH] D128318: [pseudo] prototype: faster data structures for LRTable
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 21 19:20:04 PDT 2022
sammccall created this revision.
sammccall added a reviewer: hokein.
Herald added a subscriber: mgrang.
Herald added a project: All.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, alextsao1999.
Herald added a project: clang-tools-extra.
For shift and goto, use a hashtable for faster lookups. This is ~3x bigger,
but these are not most of the actions (~15% each).
For reduce, the common pattern is that a (state, reduce rule) pair applies to
lots of possible lookahead tokens. So store this as one object with a bitmap for
the valid lookahead tokens. This is very efficient (~4x smaller than before).
Overall we're <20% bigger which seems acceptable.
Before: size of the table (bytes): 401554
After: size of the table (bytes): 470636 (Shift=196608 Reduce=77284 Goto=196608)
This yields a 24% speedup of glrParse on my machine (3.5 -> 4.35 MB/s)
rG LLVM Github Monorepo
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 13742 bytes
Desc: not available
More information about the cfe-commits