Improve performance of V3Scoreboard. Only performance change intended.

This commit is contained in:
Wilson Snyder 2021-11-03 22:16:18 -04:00
parent da5644211f
commit 8b00939f0c
2 changed files with 7 additions and 2 deletions

View File

@ -14,6 +14,7 @@ Verilator 4.215 devel
**Minor:**
* Internal code cleanups and improvements. [Geza Lore]
* Improve --thread verilation-time performance.
* Fix array method names with parens (#3181) (#3183). [Teng Huang]
* Fix split_var assign merging (#3177) (#3179). [Yutetsu TAKATSUKASA]
* Fix nested generate if genblk naming (#3189). [yanx21]

View File

@ -29,9 +29,9 @@
#include "V3Error.h"
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
//######################################################################
// SortByValueMap
@ -363,7 +363,11 @@ private:
using UserScoreFnp = T_Score (*)(const T_Elem*);
// MEMBERS
std::unordered_set<const T_Elem*> m_unknown; // Elements with unknown scores
// Below uses set<> not an unordered_set<>. unordered_set::clear() and
// construction results in a 491KB clear operation to zero all the
// buckets. Since the set size is generally small, and we iterate the
// set members, set is better performant.
std::set<const T_Elem*> m_unknown; // Elements with unknown scores
SortedMap m_sorted; // Set of elements with known scores
UserScoreFnp m_scoreFnp; // Scoring function
bool m_slowAsserts; // Do some asserts that require extra lookups