From 59f70280dee90957a672810a3845af2dec8552e8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 30 Nov 2022 11:49:56 +0200 Subject: Reserve targets, variables to avoid rehashing --- libbuild2/module.cxx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libbuild2/module.cxx') 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 -- cgit v1.1