mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 18:13:50 +02:00
Internals: Optimize temporary memory allocations (#6517)
This patch gets rid of over 80% of temporary dynamic memory allocations (when a malloced node is immediately freed with no other malloc in between). It also gets rid of over 20% of all calls to malloc. It's worth ~3% average verilation speed up with tcmalloc, and more without tcmalloc.
This commit is contained in:
+1
-1
@@ -206,7 +206,7 @@ class LocalizeVisitor final : public VNVisitor {
|
||||
AstVarScope* const varScopep = nodep->varScopep();
|
||||
// Remember this function accesses this VarScope (we always need this as we might optimize
|
||||
// this VarScope into a local, even if it's not assigned. See 'isOptimizable')
|
||||
m_accessors(varScopep).emplace(m_cfuncp);
|
||||
m_accessors(varScopep).insert(m_cfuncp); // emplace performs a temporary malloc
|
||||
// Remember the reference so we can fix it up later (we always need this as well)
|
||||
m_references(m_cfuncp).emplace(varScopep, nodep);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user