diff --git a/include/dspatch/Circuit.h b/include/dspatch/Circuit.h index 684a954e..fe0c4a8d 100644 --- a/include/dspatch/Circuit.h +++ b/include/dspatch/Circuit.h @@ -634,11 +634,6 @@ inline void Circuit::SetThreadCount( int threadCount ) { PauseAutoTick(); - if ( _threadCount == 0 && threadCount != 0 ) - { - _circuitDirty = true; - } - _threadCount = threadCount; // stop all threads @@ -799,27 +794,24 @@ inline void Circuit::_Optimize() } // scan for optimal parallel order -> update _componentsParallel - if ( _threadCount != 0 ) - { - std::vector> componentsMap; - componentsMap.reserve( _components.size() ); + std::vector> componentsMap; + componentsMap.reserve( _components.size() ); - int scanPosition; - for ( auto component : _components ) - { - component->ScanParallel( componentsMap, scanPosition ); - } - for ( auto component : _components ) - { - component->EndScan(); - } + int scanPosition; + for ( auto component : _components ) + { + component->ScanParallel( componentsMap, scanPosition ); + } + for ( auto component : _components ) + { + component->EndScan(); + } - _componentsParallel.clear(); - _componentsParallel.reserve( _components.size() ); - for ( auto& componentsMapEntry : componentsMap ) - { - _componentsParallel.insert( _componentsParallel.end(), componentsMapEntry.begin(), componentsMapEntry.end() ); - } + _componentsParallel.clear(); + _componentsParallel.reserve( _components.size() ); + for ( auto& componentsMapEntry : componentsMap ) + { + _componentsParallel.insert( _componentsParallel.end(), componentsMapEntry.begin(), componentsMapEntry.end() ); } // clear _circuitDirty flag diff --git a/include/dspatch/Component.h b/include/dspatch/Component.h index 42f4d4cb..5dcc32a9 100644 --- a/include/dspatch/Component.h +++ b/include/dspatch/Component.h @@ -491,10 +491,10 @@ inline void Component::ScanParallel( std::vector{} ); - componentsMap[_scanPosition].reserve( componentsMap.capacity() ); + componentsMap.back().reserve( componentsMap.capacity() ); } componentsMap[_scanPosition].emplace_back( this ); }