[PATCH] D127006: [pseudo] Invert rows/columns of LRTable storage for speedup. NFC

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 14:52:14 PDT 2022


sammccall created this revision.
sammccall added a reviewer: hokein.
Herald added a project: All.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, alextsao1999.
Herald added a project: clang-tools-extra.

There are more states than symbols.
This means first partioning the action list by state leaves us with a smaller
range to binary search over. This improves find() a lot and glrParse() by 7%.
The tradeoff is storing more smaller ranges increases the size of the offsets
array, overall grammar memory is +1% (337->340KB).

Before:
glrParse    188795975 ns    188778003 ns           77 bytes_per_second=1.98068M/s
After:
glrParse    175936203 ns    175916873 ns           81 bytes_per_second=2.12548M/s


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127006

Files:
  clang-tools-extra/pseudo/include/clang-pseudo/LRTable.h
  clang-tools-extra/pseudo/lib/grammar/LRTable.cpp
  clang-tools-extra/pseudo/lib/grammar/LRTableBuild.cpp
  clang-tools-extra/pseudo/tool/ClangPseudo.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127006.434150.patch
Type: text/x-patch
Size: 9939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220603/f2fa5ee8/attachment-0001.bin>


More information about the cfe-commits mailing list