diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-03 10:04:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-06-04 09:35:11 +0200 |
commit | 6e4513e2b4e32926354d745ecf08fdf440392a75 (patch) | |
tree | 3e755f6a876f08ffb98cbed8c5025dd250e980a1 /sc/source | |
parent | 77219c88ac0a44b3ed5dada67d0d9ca52fa3adec (diff) |
tdf#67538 XTypeDetection::queryTypeByDescriptor poor performance, part3
Size the OUStringBuffer in OrcusFormatDetect::detect better at
construction, to avoid re-alloc.
This is specifically fixing the performance of queryTypeByDescriptor
when called from a basic macro on a local test file.
This takes my test macro from 9s to 8s
Change-Id: Id4c2bf386de172b1deed98efece8c1f040c599a5
Reviewed-on: https://gerrit.libreoffice.org/73376
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 7bf2515fc48ed0d4c436aef298fa9c35e573352b)
Reviewed-on: https://gerrit.libreoffice.org/73400
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/filter/orcus/filterdetect.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sc/source/filter/orcus/filterdetect.cxx b/sc/source/filter/orcus/filterdetect.cxx index a9b064b01fbb..fb142d86b579 100644 --- a/sc/source/filter/orcus/filterdetect.cxx +++ b/sc/source/filter/orcus/filterdetect.cxx @@ -68,11 +68,11 @@ OUString OrcusFormatDetect::detect(css::uno::Sequence<css::beans::PropertyValue> return OUString(); css::uno::Reference<css::io::XInputStream> xInputStream(aMediaDescriptor[utl::MediaDescriptor::PROP_INPUTSTREAM()], css::uno::UNO_QUERY ); + OStringBuffer aContent(xInputStream->available()); static const sal_Int32 nBytes = 4096; css::uno::Sequence<sal_Int8> aSeq(nBytes); bool bEnd = false; - OStringBuffer aContent; while(!bEnd) { sal_Int32 nReadBytes = xInputStream->readBytes(aSeq, nBytes); |