Skip to content

Commit 0db9cf4

Browse files
fzakariaxokdvium
andauthored
Update src/libflake/lockfile.cc
Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
1 parent 7382852 commit 0db9cf4

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/libflake/lockfile.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,7 @@ std::pair<nlohmann::json, LockFile::KeyMap> LockFile::toJSON() const
189189
boost::unordered_flat_set<std::string> keys;
190190

191191
/* The highest numeric suffix already handed out for a given base key.
192-
Restarting the search at 2 for every collision is quadratic when many
193-
nodes share a base name, which is exactly what happens in a flake with
194-
hundreds of inputs that each pull in their own "systems" or "nixpkgs". */
192+
Used to amortise name deduplication by memoising the lower bound of suffixes that definitely cannot be used. */
195193
boost::unordered_flat_map<std::string, int> keySuffixes;
196194

197195
auto dumpNode = [&](this auto & dumpNode, std::string key, ref<const Node> node) -> std::string {

0 commit comments

Comments
 (0)