From 77fc9816696ebed3cc8685a8fdee464799f2a157 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 18 Apr 2022 13:49:16 +0200 Subject: Skip find() inside target_set::insert*() if target is unlikely to be there --- libbuild2/search.cxx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'libbuild2/search.cxx') 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 ()); @@ -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); -- cgit v1.1