From 214bc8317696f31d7a121d41e5484d91b0959444 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 28 Aug 2016 15:26:20 +0200 Subject: Optimize library processing --- build2/cc/link.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'build2/cc/link.cxx') diff --git a/build2/cc/link.cxx b/build2/cc/link.cxx index e6e7a98..d0e887e 100644 --- a/build2/cc/link.cxx +++ b/build2/cc/link.cxx @@ -38,7 +38,6 @@ namespace build2 { } - match_result link:: match (action a, target& t, const string& hint) const { @@ -559,6 +558,9 @@ namespace build2 file& l, bool la, scope& bs, lorder lo) const { + // Note: lack of the "small function object" optimization will really + // kill us here since we are called in a loop. + // bool win (tclass == "windows"); auto imp = [] (file&, bool la) {return la;}; @@ -734,6 +736,11 @@ namespace build2 d.args.push_back (move (o)); }; + // In case we don't have the "small function object" optimization. + // + const function impf (imp); + const function libf (lib); + for (target* pt: t.prerequisite_targets) { file* f; @@ -754,7 +761,7 @@ namespace build2 process_libraries (bs, lo, sys_lib_dirs, *f, a != nullptr, - imp, lib, nullptr); + impf, libf, nullptr); } } } -- cgit v1.1