No need to check for reserved space.

This commit is contained in:
Bartosz Taudul 2018-03-15 21:32:06 +01:00
parent b7ba64a223
commit c510c9705b
2 changed files with 7 additions and 3 deletions

View File

@ -87,6 +87,11 @@ public:
m_ptr[m_size++] = v; m_ptr[m_size++] = v;
} }
void push_back_no_space_check( const T& v )
{
m_ptr[m_size++] = v;
}
void push_back( T&& v ) void push_back( T&& v )
{ {
if( m_size == Capacity() ) AllocMore(); if( m_size == Capacity() ) AllocMore();

View File

@ -1566,7 +1566,7 @@ void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec )
for( uint64_t i=0; i<sz; i++ ) for( uint64_t i=0; i<sz; i++ )
{ {
auto zone = m_slab.AllocInit<ZoneEvent>(); auto zone = m_slab.AllocInit<ZoneEvent>();
vec.push_back( zone ); vec.push_back_no_space_check( zone );
f.Read( &zone->start, sizeof( zone->start ) ); f.Read( &zone->start, sizeof( zone->start ) );
f.Read( &zone->end, sizeof( zone->end ) ); f.Read( &zone->end, sizeof( zone->end ) );
@ -1587,8 +1587,7 @@ void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec )
for( uint64_t i=0; i<sz; i++ ) for( uint64_t i=0; i<sz; i++ )
{ {
auto zone = m_slab.AllocInit<GpuEvent>(); auto zone = m_slab.AllocInit<GpuEvent>();
vec.push_back_no_space_check( zone );
vec.push_back( zone );
f.Read( &zone->cpuStart, sizeof( zone->cpuStart ) ); f.Read( &zone->cpuStart, sizeof( zone->cpuStart ) );
f.Read( &zone->cpuEnd, sizeof( zone->cpuEnd ) ); f.Read( &zone->cpuEnd, sizeof( zone->cpuEnd ) );