[all-commits] [llvm/llvm-project] 003a72: [NFC] Don't recompute type name (#119631)

Ian Wood via All-commits all-commits at lists.llvm.org
Fri Dec 13 09:14:46 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 003a721c1c9e3a99d6d0c1a6755443b260235537
      https://github.com/llvm/llvm-project/commit/003a721c1c9e3a99d6d0c1a6755443b260235537
  Author: Ian Wood <ianwood2024 at u.northwestern.edu>
  Date:   2024-12-13 (Fri, 13 Dec 2024)

  Changed paths:
    M llvm/include/llvm/Support/TypeName.h

  Log Message:
  -----------
  [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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list