]> git.tdb.fi Git - builder.git/commitdiff
Optimize Binary::collect_build_info
authorMikko Rasa <tdb@tdb.fi>
Fri, 30 Dec 2022 22:37:59 +0000 (00:37 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 30 Dec 2022 22:37:59 +0000 (00:37 +0200)
It's likely that all object files are built with very few different
tools, evne just one.  Updating the build info multiple times from the
same tool is pointless.

source/lib/binary.cpp

index f245037b6b24abe35662b46ab04219dad5de7e7f..9d73785911d806c9ff5746403b66b271990219a5 100644 (file)
@@ -28,9 +28,13 @@ Binary::Binary(Builder &b, const Component &c, const string &p, const vector<Obj
 
 void Binary::collect_build_info(BuildInfo &binfo) const
 {
+       vector<const Tool *> tools;
        for(ObjectFile *o: objects)
                if(const Tool *obj_tool = o->get_tool())
-                       binfo.update_from(obj_tool->get_build_info());
+                       if(!any_equals(tools, obj_tool))
+                               tools.push_back(obj_tool);
+       for(const Tool *t: tools)
+               binfo.update_from(t->get_build_info());
 
        Target::collect_build_info(binfo);