diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-05 14:12:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-06 08:23:35 +0200 |
commit | ad1e790d76492ca4465114ad17e32912242db34f (patch) | |
tree | dccd3a678460fe05e7c2f7fd201c613f136439da /comphelper | |
parent | 1cf48243995410ca9455df573dff94d122874f0b (diff) |
small optimisations
In UNOMemoryStream
(a) let the vector use it's natural grow strategy, so we avoid extending
the vector by only the small amount we need now.
(b) don't throw the vector storage away on truncate, we might need it
soon
In unoidl/ reserve some vector capacities.
Change-Id: I6668a679e689d46d311a9e11eb3d0bc3395f3b6e
Reviewed-on: https://gerrit.libreoffice.org/75136
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/streaming/memorystream.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx index a4e713777a90..4477cd068188 100644 --- a/comphelper/source/streaming/memorystream.cxx +++ b/comphelper/source/streaming/memorystream.cxx @@ -197,7 +197,7 @@ void SAL_CALL UNOMemoryStream::writeBytes( const Sequence< sal_Int8 >& aData ) } if( static_cast< sal_Int32 >( nNewSize ) > static_cast< sal_Int32 >( maData.size() ) ) - maData.resize( static_cast< sal_Int32 >( nNewSize ) ); + maData.insert( maData.end(), nNewSize - maData.size(), 0 ); sal_Int8* pData = &(*maData.begin()); sal_Int8* pCursor = &(pData[mnCursor]); @@ -219,7 +219,7 @@ void SAL_CALL UNOMemoryStream::closeOutput() //XTruncate void SAL_CALL UNOMemoryStream::truncate() { - maData.resize( 0 ); + maData.clear(); mnCursor = 0; } |