[all-commits] [llvm/llvm-project] 4f73c8: [clang][lex] Store `HeaderFileInfo` in a `MapVecto...
Jan Svoboda via All-commits
all-commits at lists.llvm.org
Fri Jun 5 15:07:18 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4f73c8195b51042d349916c162663252c7f60eb7
https://github.com/llvm/llvm-project/commit/4f73c8195b51042d349916c162663252c7f60eb7
Author: Jan Svoboda <jan_svoboda at apple.com>
Date: 2026-06-05 (Fri, 05 Jun 2026)
Changed paths:
M clang/include/clang/Basic/FileManager.h
M clang/include/clang/Lex/HeaderSearch.h
M clang/lib/Basic/FileManager.cpp
M clang/lib/Lex/HeaderSearch.cpp
M clang/lib/Serialization/ASTWriter.cpp
M llvm/include/llvm/ADT/MapVector.h
Log Message:
-----------
[clang][lex] Store `HeaderFileInfo` in a `MapVector` (#201936)
This is a re-commit of PR #200968 (f357a47) that was reverted by PR
#201702 (adaa9e0). One call-site of
`HeaderSearch::forEachExistingLocalFileInfo()` in `ASTWriter` relies on
stable order, which the `DenseMap` didn't provide. This PR switches to
`MapVector`, which has the same performance characteristics as the
original solution at the cost of a theoretical memory usage increase.
Original PR description:
Calling `FileManager::GetUniqueIDMapping()` during modular builds gets
very expensive if the `FileManager` has seen lots of files. This
function is used in two places in the `ASTWriter` to look up
`HeaderFileInfo` in `HeaderSearch`.
This PR changes the storage of `HeaderFileInfo` from
`FileEntry::getUID()`-indexed `std::vector<T>` to
`llvm::DenseMap<FileEntryRef, T>`, improving scanning performance by
~2.5%.
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