[all-commits] [llvm/llvm-project] 784bd6: [clang] Speedup getFileIDLocal with a separate off...

Haojian Wu via All-commits all-commits at lists.llvm.org
Mon Jul 7 00:42:59 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 784bd61fc497b11a6d8d30abb6157c8a3597ffbf
      https://github.com/llvm/llvm-project/commit/784bd61fc497b11a6d8d30abb6157c8a3597ffbf
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2025-07-07 (Mon, 07 Jul 2025)

  Changed paths:
    M clang/include/clang/Basic/SourceManager.h
    M clang/lib/Basic/SourceManager.cpp

  Log Message:
  -----------
  [clang] Speedup getFileIDLocal with a separate offset table. (#146604)

The `SLocEntry` structure is 24 bytes, and the binary search only needs
the offset. Loading an entry's offset might pull the entire SLocEntry
object into the CPU cache.

To make the binary search much more cache-efficient, we use a separate
offset table.

See
https://llvm-compile-time-tracker.com/compare.php?from=650d0151c623c123e4e9736fe50421624a329260&to=6af564c0d75aff28a2784a8554448c0679877792&stat=instructions:u.



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