From c9fc975259e27220caeb4291f3dff453e65f1965 Mon Sep 17 00:00:00 2001 From: pennae Date: Sun, 2 Jan 2022 00:41:21 +0100 Subject: optimize removeAttrs builtin use a sorted array of symbols to be removed instead of a set. this saves a lot of memory allocations and slightly speeds up removal. --- src/libexpr/attr-set.hh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libexpr/attr-set.hh') diff --git a/src/libexpr/attr-set.hh b/src/libexpr/attr-set.hh index 82c348287..3e4899efc 100644 --- a/src/libexpr/attr-set.hh +++ b/src/libexpr/attr-set.hh @@ -121,6 +121,8 @@ class BindingsBuilder Bindings * bindings; public: + // needed by std::back_inserter + using value_type = Attr; EvalState & state; @@ -134,6 +136,11 @@ public: } void insert(const Attr & attr) + { + push_back(attr); + } + + void push_back(const Attr & attr) { bindings->push_back(attr); } -- cgit v1.2.3