aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/variable.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-11-30 11:49:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-11-30 11:49:56 +0200
commit59f70280dee90957a672810a3845af2dec8552e8 (patch)
tree609b729c394b44a38418a6f19d03893dbfbd0e9f /libbuild2/variable.hxx
parent3bbbe09e8629ab5311a1bcbb9f56aa6a33e36f55 (diff)
Reserve targets, variables to avoid rehashing
Diffstat (limited to 'libbuild2/variable.hxx')
-rw-r--r--libbuild2/variable.hxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/libbuild2/variable.hxx b/libbuild2/variable.hxx
index 3b444e6..400aaf1 100644
--- a/libbuild2/variable.hxx
+++ b/libbuild2/variable.hxx
@@ -16,6 +16,7 @@
#include <libbuild2/context.hxx>
#include <libbuild2/target-type.hxx>
+#include <libbuild2/diagnostics.hxx>
#include <libbuild2/export.hxx>
@@ -1470,7 +1471,21 @@ namespace build2
auto r (map_.insert (map::value_type (&n, move (var))));
if (r.second)
+ {
+#if 0
+ if (shared_ && outer_ == nullptr) // Global pool in context.
+ {
+ size_t n (map_.bucket_count ());
+ if (n > buckets_)
+ {
+ text << "variable_pool buckets: " << buckets_ << " -> " << n
+ << " (" << map_.size () << ")";
+ buckets_ = n;
+ }
+ }
+#endif
r.first->first.p = &r.first->second.name;
+ }
return r;
}
@@ -1482,6 +1497,10 @@ namespace build2
variable_pool* outer_;
const variable_patterns* patterns_;
map map_;
+
+#if 0
+ size_t buckets_ = 0;
+#endif
};
// Variable patterns.