This is an archive of the discontinued LLVM Phabricator instance.

[pseudo] prototype: faster data structures for LRTable
AbandonedPublic

Authored by sammccall on Jun 21 2022, 7:20 PM.

Details

Reviewers
hokein
Summary

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)

Diff Detail

Event Timeline

sammccall created this revision.Jun 21 2022, 7:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2022, 7:20 PM
Herald added a subscriber: mgrang. · View Herald Transcript
sammccall requested review of this revision.Jun 21 2022, 7:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2022, 7:20 PM

I'm happy with the data structures at this point, so if you have feedback on those that'd be great.
Otherwise I still need to clean up the interfaces, fix the broken tests, add some more comments etc.

sammccall abandoned this revision.Jun 27 2022, 4:17 PM

This is obsoleted by D128485 and D128472