Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover performance loss after PagedVector introduction #67972

Merged
merged 4 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/SourceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
///
/// Negative FileIDs are indexes into this table. To get from ID to an index,
/// use (-ID - 2).
llvm::PagedVector<SrcMgr::SLocEntry> LoadedSLocEntryTable;
llvm::PagedVector<SrcMgr::SLocEntry, 32> LoadedSLocEntryTable;

/// For each allocation in LoadedSLocEntryTable, we keep the first FileID.
/// We assume exactly one allocation per AST file, and use that to determine
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/ADT/PagedVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ template <typename T, size_t PageSize = 1024 / sizeof(T)> class PagedVector {
assert(Index / PageSize < PageToDataPtrs.size());
T *&PagePtr = PageToDataPtrs[Index / PageSize];
// If the page was not yet allocated, allocate it.
if (!PagePtr) {
if (LLVM_UNLIKELY(!PagePtr)) {
PagePtr = Allocator.getPointer()->template Allocate<T>(PageSize);
// We need to invoke the default constructor on all the elements of the
// page.
Expand Down
Loading