summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-04-04 15:49:01 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-04 15:49:01 +0000
commit3faa382d4feb3c272333f20e16106a5bbc472990 (patch)
tree272d199d991c7dcf17e7ae97252cb652c21f9240 /core/fxcrt
parentc80153d94ed0d540c706b7f7bdb993772b2be9f7 (diff)
downloadpdfium-3faa382d4feb3c272333f20e16106a5bbc472990.tar.xz
Decrease XML parser buffer size
This CL decreases the m_iXMLPlaneSize in the CFX_XMLSyntaxParser from 32*1024 to 1024 bytes. This plane size is the size of the chunks we read the XML file in. The issue with having a large plane size is inside the CFX_SeekableStreamProxy::ReadString we allocate a vector of the min(planeSize, remaining_bytes). This means, we could potentially be allocating 32*1024 bytes to read in a single character. For the test in the attached bug the runtime went from 12s to 25ms. Bug: chromium:813195 Change-Id: Id57e619b7a118d45e3fed491ad81e86a4b1cacb8 Reviewed-on: https://pdfium-review.googlesource.com/29750 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/xml/cfx_xmlsyntaxparser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
index c0cc1a6ac9..1fb51b7d52 100644
--- a/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlsyntaxparser.cpp
@@ -78,7 +78,7 @@ bool CFX_XMLSyntaxParser::IsXMLNameChar(wchar_t ch, bool bFirstChar) {
CFX_XMLSyntaxParser::CFX_XMLSyntaxParser(
const RetainPtr<CFX_SeekableStreamProxy>& pStream)
: m_pStream(pStream),
- m_iXMLPlaneSize(32 * 1024),
+ m_iXMLPlaneSize(1024),
m_iCurrentPos(0),
m_iCurrentNodeNum(-1),
m_iLastNodeNum(-1),