1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-21 09:49:36 +01:00

Reduce false sharing between pathInfoCache and Store

`perf c2c` shows a lot of cacheline conflicts between purely read-only
Store methods (like `parseStorePath()`) and the Sync classes. So
allocate pathInfoCache separately to avoid that.
This commit is contained in:
Eelco Dolstra 2025-09-04 11:54:59 +02:00
parent 5ae1b5f88b
commit a73cf447ac
7 changed files with 37 additions and 63 deletions

View file

@ -716,12 +716,8 @@ uint64_t LocalStore::addValidPath(State & state, const ValidPathInfo & info, boo
}
}
{
auto state_(Store::state.lock());
state_->pathInfoCache.upsert(
std::string(info.path.to_string()),
PathInfoCacheValue{.value = std::make_shared<const ValidPathInfo>(info)});
}
pathInfoCache->lock()->upsert(
std::string(info.path.to_string()), PathInfoCacheValue{.value = std::make_shared<const ValidPathInfo>(info)});
return id;
}
@ -1023,10 +1019,7 @@ void LocalStore::invalidatePath(State & state, const StorePath & path)
/* Note that the foreign key constraints on the Refs table take
care of deleting the references entries for `path'. */
{
auto state_(Store::state.lock());
state_->pathInfoCache.erase(std::string(path.to_string()));
}
pathInfoCache->lock()->erase(std::string(path.to_string()));
}
const PublicKeys & LocalStore::getPublicKeys()