Leaner iteration in Profiler::Dequeue().

This commit is contained in:
Bartosz Taudul 2017-11-22 02:07:23 +01:00
parent 7f74d35955
commit 630db7112a

View File

@ -264,9 +264,10 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
const auto sz = s_queue.try_dequeue_bulk( token, m_itemBuf, BulkSize ); const auto sz = s_queue.try_dequeue_bulk( token, m_itemBuf, BulkSize );
if( sz > 0 ) if( sz > 0 )
{ {
for( size_t i=0; i<sz; i++ ) auto end = m_itemBuf + sz;
auto item = m_itemBuf;
while( item != end )
{ {
const auto item = m_itemBuf + i;
uint64_t ptr; uint64_t ptr;
switch( item->hdr.type ) switch( item->hdr.type )
{ {
@ -288,7 +289,8 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
default: default:
break; break;
} }
if( !AppendData( item, QueueDataSize[m_itemBuf[i].hdr.idx] ) ) return ConnectionLost; if( !AppendData( item, QueueDataSize[item->hdr.idx] ) ) return ConnectionLost;
item++;
} }
} }
else else