summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2021-06-21 12:54:29 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-23 14:29:57 +0200
commit9815bf197c27afdfeccf967898c3a000bcf7b256 (patch)
tree220d5f3dd9b95c9ef898d6b92cc9c7de81ad7213 /tools
parent90df123cd9ff9fc1c7b991d9ae9a1ed8c9e9f0de (diff)
tdf#135316 add SvFileStream::SetDontFlushOnClose
if we're going to be deleting a temporary file, there is no point flushing it on close, which has a measureable cost This takes my load time from 17s to 16s Change-Id: I2fce7eeaf0ce9fef826b4ce9a1a4d4c8114cac76 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117607 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/stream/strmunx.cxx5
-rw-r--r--tools/source/stream/strmwnt.cxx5
2 files changed, 8 insertions, 2 deletions
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 0b745e69b140..e034f53ac33b 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -197,6 +197,7 @@ SvFileStream::SvFileStream( const OUString& rFileName, StreamMode nOpenMode )
{
bIsOpen = false;
m_isWritable = false;
+ mbDontFlushOnClose = false;
pInstanceData.reset(new StreamData);
SetBufferSize( 1024 );
@@ -214,6 +215,7 @@ SvFileStream::SvFileStream()
{
bIsOpen = false;
m_isWritable = false;
+ mbDontFlushOnClose = false;
pInstanceData.reset(new StreamData);
SetBufferSize( 1024 );
}
@@ -457,7 +459,8 @@ void SvFileStream::Close()
if ( IsOpen() )
{
SAL_INFO("tools", "Closing " << aFilename);
- Flush();
+ if ( !mbDontFlushOnClose )
+ Flush();
osl_closeFile( pInstanceData->rHandle );
pInstanceData->rHandle = nullptr;
}
diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx
index d85ce3a0c372..c91628b55091 100644
--- a/tools/source/stream/strmwnt.cxx
+++ b/tools/source/stream/strmwnt.cxx
@@ -107,6 +107,7 @@ SvFileStream::SvFileStream( const OUString& rFileName, StreamMode nMode )
bIsOpen = false;
nLockCounter = 0;
m_isWritable = false;
+ mbDontFlushOnClose = false;
pInstanceData.reset( new StreamData );
SetBufferSize( 8192 );
@@ -123,6 +124,7 @@ SvFileStream::SvFileStream()
bIsOpen = false;
nLockCounter = 0;
m_isWritable = false;
+ mbDontFlushOnClose = false;
pInstanceData.reset( new StreamData );
SetBufferSize( 8192 );
@@ -377,7 +379,8 @@ void SvFileStream::Close()
nLockCounter = 1;
UnlockFile();
}
- Flush();
+ if ( !mbDontFlushOnClose )
+ Flush();
CloseHandle( pInstanceData->hFile );
}
bIsOpen = false;