SigMap performance improvement
authorClifford Wolf <clifford@clifford.at>
Mon, 1 Feb 2016 09:10:20 +0000 (10:10 +0100)
committerClifford Wolf <clifford@clifford.at>
Mon, 1 Feb 2016 09:10:20 +0000 (10:10 +0100)
kernel/sigtools.h

index 83ff470d25f3ada33d5215225b775bc3b4eb9798..4e97bb7755061d34c88c683ce8999deae6bebb3d 100644 (file)
@@ -242,7 +242,13 @@ struct SigMap
 
        void set(RTLIL::Module *module)
        {
-               clear();
+               int bitcount = 0;
+               for (auto &it : module->connections())
+                       bitcount += it.first.size();
+
+               database.clear();
+               database.reserve(bitcount);
+
                for (auto &it : module->connections())
                        add(it.first, it.second);
        }