From 9452c6146297ed0c998c3fac9247126340e9229f Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Mon, 29 Jan 2018 12:37:34 -0500 Subject: [PATCH] Use vector instead of bitset for VIEW_ITEM_DATA layer storage Shows 10-15% speed improvement in rendering large files in MacOS --- common/view/view.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/common/view/view.cpp b/common/view/view.cpp index 75d4d91c76..673a3ab21d 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -78,13 +78,10 @@ private: { int* layersPtr = aLayers; - for( unsigned int i = 0; i < m_layers.size(); ++i ) - { - if( m_layers[i] ) - *layersPtr++ = i; - } + for( auto layer : m_layers ) + *layersPtr++ = layer; - aCount = m_layers.count(); + aCount = m_layers.size(); } VIEW* m_view; ///< Current dynamic view the item is assigned to. @@ -193,7 +190,7 @@ private: } /// Stores layer numbers used by the item. - std::bitset m_layers; + std::vector m_layers; /** * Function saveLayers() @@ -204,14 +201,14 @@ private: */ void saveLayers( int* aLayers, int aCount ) { - m_layers.reset(); + m_layers.clear(); for( int i = 0; i < aCount; ++i ) { // this fires on some eagle board after EAGLE_PLUGIN::Load() wxASSERT( unsigned( aLayers[i] ) <= unsigned( VIEW::VIEW_MAX_LAYERS ) ); - m_layers.set( aLayers[i] ); + m_layers.push_back( aLayers[i] ); } }