aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/attr-set.hh
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2018-02-19 22:47:25 +0200
committerTuomas Tynkkynen <tuomas@tuxera.com>2018-02-19 22:47:25 +0200
commit056d28a60110975332d8cb0c08990a1d3d8060a7 (patch)
tree1fa5d93defd8f05ea005ac68ced1c2d3af48de74 /src/libexpr/attr-set.hh
parentd4e93532e2695fa7204937a96573b686a3b1a1ea (diff)
libexpr: Don't create lots of temporary strings in Bindings::lexicographicOrder
Avoids ~180,000 string temporaries created when evaluating a headless NixOS system.
Diffstat (limited to 'src/libexpr/attr-set.hh')
-rw-r--r--src/libexpr/attr-set.hh2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libexpr/attr-set.hh b/src/libexpr/attr-set.hh
index e1fc2bf6d..3119a1848 100644
--- a/src/libexpr/attr-set.hh
+++ b/src/libexpr/attr-set.hh
@@ -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;
}