aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/module.cxx
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/module.cxx
parent3bbbe09e8629ab5311a1bcbb9f56aa6a33e36f55 (diff)
Reserve targets, variables to avoid rehashing
Diffstat (limited to 'libbuild2/module.cxx')
-rw-r--r--libbuild2/module.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/libbuild2/module.cxx b/libbuild2/module.cxx
index 96901ff..62145ca 100644
--- a/libbuild2/module.cxx
+++ b/libbuild2/module.cxx
@@ -77,6 +77,9 @@ namespace build2
// same global mutexes. Also disable nested module context for good
// measure.
//
+ // The reserve values were picked experimentally by building libbuild2 and
+ // adding a reasonable margin for future growth.
+ //
ctx.module_context_storage->reset (
new context (ctx.sched,
ctx.mutexes,
@@ -87,6 +90,10 @@ namespace build2
ctx.no_diag_buffer,
ctx.keep_going,
ctx.global_var_overrides, /* cmd_vars */
+ context::reserves {
+ 2500, /* targets */
+ 900 /* variables */
+ },
nullopt)); /* module_context */
// We use the same context for building any nested modules that might be