[all-commits] [llvm/llvm-project] 93bcff: [pseudo] Invert rows/columns of LRTable storage fo...

Sam McCall via All-commits all-commits at lists.llvm.org
Wed Jun 8 14:35:29 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 93bcff8aa85512f2b24e822d857b426c31b6d051
      https://github.com/llvm/llvm-project/commit/93bcff8aa85512f2b24e822d857b426c31b6d051
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-06-08 (Wed, 08 Jun 2022)

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

  Log Message:
  -----------
  [pseudo] Invert rows/columns of LRTable storage for speedup. NFC

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

Differential Revision: https://reviews.llvm.org/D127006




More information about the All-commits mailing list