llvm-project
003a721c - [NFC] Don't recompute type name (#119631)

Commit
326 days ago
[NFC] Don't recompute type name (#119631) This change uses a local static variable to cache the computed `StringRef` containing the type's name. I found that `RelWithDebInfo` builds of MLIR were spending a relatively large amount of time in `StringRef::find` and I tracked it down to `getTypeName` which utilizes `StringRef` methods that are defined in a separate translation unit. This is especially impactful on perf because `getTypeName` is supposed to be used for debug logging. See an example here: https://github.com/llvm/llvm-project/blob/4b825c7417f72ee88ee3e4316d0c01ed463f1241/mlir/include/mlir/IR/Types.h#L294-L300
Author
Parents
Loading