Commit 003a721
authored
[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-L3001 parent 3fcc302 commit 003a721
1 file changed
+18
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 16 | + | |
| 17 | + | |
28 | 18 | | |
29 | 19 | | |
30 | 20 | | |
| |||
58 | 48 | | |
59 | 49 | | |
60 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
| |||
0 commit comments