1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00

symbol-table: reduce memory usage and use boost::unordered_flat_set

This commit is contained in:
Philipp Otterbein 2025-05-18 03:53:50 +02:00
parent 32d19040e7
commit 94bbaddb93
5 changed files with 199 additions and 59 deletions

View file

@ -2,6 +2,7 @@
#include "nix/expr/eval-settings.hh"
#include "nix/expr/primops.hh"
#include "nix/expr/print-options.hh"
#include "nix/expr/symbol-table.hh"
#include "nix/util/exit.hh"
#include "nix/util/types.hh"
#include "nix/util/util.hh"
@ -918,6 +919,11 @@ void Value::mkStringMove(const char * s, const NixStringContext & context)
mkString(s, encodeContext(context));
}
void Value::mkString(const SymbolStr & s)
{
mkString(s.c_str(), nullptr);
}
void Value::mkPath(const SourcePath & path)
{
mkPath(&*path.accessor, makeImmutableString(path.path.abs()));
@ -3019,7 +3025,7 @@ void EvalState::printStatistics()
// XXX: overrides earlier assignment
topObj["symbols"] = json::array();
auto &list = topObj["symbols"];
symbols.dump([&](const std::string & s) { list.emplace_back(s); });
symbols.dump([&](std::string_view s) { list.emplace_back(s); });
}
if (outPath == "-") {
std::cerr << topObj.dump(2) << std::endl;