libexpr: Don't create lots of temporary strings in Bindings::lexicographicOrder

Avoids ~180,000 string temporaries created when evaluating a headless
NixOS system.
This commit is contained in:
Tuomas Tynkkynen 2018-02-19 22:47:25 +02:00
parent d4e93532e2
commit 056d28a601

View file

@ -83,7 +83,7 @@ public:
for (size_t n = 0; n < size_; n++)
res.emplace_back(&attrs[n]);
std::sort(res.begin(), res.end(), [](const Attr * a, const Attr * b) {
return (string) a->name < (string) b->name;
return (const string &) a->name < (const string &) b->name;
});
return res;
}