Don't call driverName() unless we have a cache miss.
(That is, in fact, the whole purpose of this cache.)
(cherry picked from commit e48a96ecaf
)
This commit is contained in:
parent
246be732a1
commit
db526e581c
|
@ -356,9 +356,12 @@ wxString CONNECTION_SUBGRAPH::driverName( SCH_ITEM* aItem ) const
|
|||
|
||||
const wxString& CONNECTION_SUBGRAPH::GetNameForDriver( SCH_ITEM* aItem ) const
|
||||
{
|
||||
auto [it, success] = m_driver_name_cache.try_emplace( aItem, driverName( aItem ) );
|
||||
auto it = m_driver_name_cache.find( aItem );
|
||||
|
||||
return it->second;
|
||||
if( it != m_driver_name_cache.end() )
|
||||
return it->second;
|
||||
|
||||
return m_driver_name_cache.emplace( aItem, driverName( aItem ) ).first->second;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue