aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/search.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-04-18 13:49:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-04-19 04:12:34 +0200
commit77fc9816696ebed3cc8685a8fdee464799f2a157 (patch)
tree936a3379bcc91593f1a96ba5958ab64f841f43ec /libbuild2/search.cxx
parent095583f1fbab20937720f9311ddb9945ff2b9224 (diff)
Skip find() inside target_set::insert*() if target is unlikely to be there
Diffstat (limited to 'libbuild2/search.cxx')
-rw-r--r--libbuild2/search.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/libbuild2/search.cxx b/libbuild2/search.cxx
index d3638d7..19385b0 100644
--- a/libbuild2/search.cxx
+++ b/libbuild2/search.cxx
@@ -187,13 +187,16 @@ namespace build2
// Find or insert. Note that we are using our updated extension.
//
+ // More often insert than find, so skip find in insert().
+ //
auto r (ctx.targets.insert (*tk.type,
move (d),
move (out),
*tk.name,
ext,
target_decl::prereq_file,
- trace));
+ trace,
+ true /* skip_find */));
const file& t (r.first.as<file> ());
@@ -230,6 +233,8 @@ namespace build2
// Find or insert.
//
+ // More often insert than find, so skip find in insert().
+ //
// @@ OUT: same story as in search_existing_target() re out.
//
auto r (ctx.targets.insert (*tk.type,
@@ -238,7 +243,8 @@ namespace build2
*tk.name,
tk.ext,
target_decl::prereq_new,
- trace));
+ trace,
+ true /* skip_find */));
const target& t (r.first);
l5 ([&]{trace << (r.second ? "new" : "existing") << " target " << t
@@ -271,6 +277,8 @@ namespace build2
// Find or insert.
//
+ // More often insert than find, so skip find in insert_locked().
+ //
// @@ OUT: same story as in search_existing_target() re out.
//
auto r (ctx.targets.insert_locked (*tk.type,
@@ -279,7 +287,8 @@ namespace build2
*tk.name,
tk.ext,
target_decl::prereq_new,
- trace));
+ trace,
+ true /* skip_find */));
l5 ([&]
{
diag_record dr (trace);