VImage: reserve vector before push_back loop
Avoids unnecessary resizes. Found with clang-tidy's performance-inefficient-vector-operation Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
6dd6fafa2a
commit
3f57c0a515
@ -767,6 +767,7 @@ std::vector<VImage>
|
|||||||
VImage::bandsplit( VOption *options ) const
|
VImage::bandsplit( VOption *options ) const
|
||||||
{
|
{
|
||||||
std::vector<VImage> b;
|
std::vector<VImage> b;
|
||||||
|
b.reserve(bands());
|
||||||
|
|
||||||
for( int i = 0; i < bands(); i++ )
|
for( int i = 0; i < bands(); i++ )
|
||||||
b.push_back( extract_band( i ) );
|
b.push_back( extract_band( i ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user