[PATCH] D153171: [SpecialCaseList] Remove TrigramIndex

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 16 23:23:00 PDT 2023


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

> Using perf I found that most of the runtime in TrigramIndex::isDefinitelyOut() comes from a division operation that seems to come from std::unordered_map: https://github.com/llvm/llvm-project/blob/8e1f820bb4eadf5c0704818f6063e0db1006e32d/llvm/include/llvm/Support/TrigramIndex.h#L62

I guess it doesn't use `DenseMap` to protect the case that the key collides with the empty/tombstone keys, but `std::unordered_map` has very bad performance...
Another problem with TrigramIndex is that we need to iterate over the full query, while with a regex engine I think we can often bail out early.

I have tested TrigramIndex removal with a large `ubsan_ignorelist.txt` and the performance is better (1.10+ x as fast). We should give some time for #sanitizers <https://reviews.llvm.org/tag/sanitizers/> folks to respond.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153171/new/

https://reviews.llvm.org/D153171



More information about the llvm-commits mailing list