diff options
author | pennae <github@quasiparticle.net> | 2022-01-02 00:41:21 +0100 |
---|---|---|
committer | pennae <github@quasiparticle.net> | 2022-01-14 14:01:52 +0100 |
commit | c9fc975259e27220caeb4291f3dff453e65f1965 (patch) | |
tree | 0a354f5e80c59ad5eac65b84bb6db3ba0869d8e3 /src/libexpr/attr-set.hh | |
parent | 6401e443a441f58f48e2cbab5286b89ec162835a (diff) |
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.
Diffstat (limited to 'src/libexpr/attr-set.hh')
-rw-r--r-- | src/libexpr/attr-set.hh | 7 |
1 files changed, 7 insertions, 0 deletions
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; @@ -135,6 +137,11 @@ public: void insert(const Attr & attr) { + push_back(attr); + } + + void push_back(const Attr & attr) + { bindings->push_back(attr); } |