[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pnet-developers] XmlTextReader performance problems and ResX
From: |
Marcus |
Subject: |
[Pnet-developers] XmlTextReader performance problems and ResX |
Date: |
Thu, 20 Jan 2005 23:04:37 -0600 |
User-agent: |
KMail/1.7.91 |
In another email, I reported that I was debugging ResXResourceReader. This
class reads .resx files, which are in XML format. Items such as bitmaps can
be embedded in the .resx files, so they can be quite large.
ResXResourceReader uses the XmlTextReader class to read the file. After
fixing these bugs, I can actually read resource files with the class.
However, I discovered that my test app was getting bogged down in the
XmlTextReader.ReadElementString().
I wrote a standalone test that reads an XML file that contains an element with
a large amount of text, similar to that in a .resx file. I experimented with
various sizes of the data and discovered that the time required to read the
element string was O(n^2). (For example, approx 1006 lines took 3 seconds,
2000 took 11, 5000 took 63, and 10000 took 251.)
I cannot tell why the time required is increasing quadratically. The number of
calls to the "hot" (frequently-called) methods only increases linearly (see
below).
"Hot" methods for 1000 lines:
178920 instance bool
System.Xml.Private.XmlParserInput::EnsureCapacity(int32)
99606 instance int32 System.Text.StringBuilder::AppendSpace(int32)
99599 void System.String::CharFill(class System.String, int32, int32,
char)
99599 instance class System.Text.StringBuilder
System.Text.StringBuilder::Append(char)
89469 instance bool System.Xml.Private.XmlParserInput::PeekChar()
89451 instance bool System.Xml.Private.XmlParserInput::NextChar()
89451 instance void
System.Xml.Private.XmlParserInputBase/LogManager::Append(char)
7255 class System.String System.String::NewBuilder(class System.String,
int32)
6683 instance class System.String
System.Text.StringBuilder::NewBuilder(class System.String, int32)
4233 instance int32 System.String::get_Length()
"Hot" methods for 2000 lines:
357098 instance bool
System.Xml.Private.XmlParserInput::EnsureCapacity(int32)
188695 instance int32 System.Text.StringBuilder::AppendSpace(int32)
188688 void System.String::CharFill(class System.String, int32, int32,
char)
188688 instance class System.Text.StringBuilder
System.Text.StringBuilder::Append(char)
178558 instance bool System.Xml.Private.XmlParserInput::PeekChar()
178540 instance bool System.Xml.Private.XmlParserInput::NextChar()
178540 instance void
System.Xml.Private.XmlParserInputBase/LogManager::Append(char)
10039 class System.String System.String::NewBuilder(class System.String,
int32)
9467 instance class System.String
System.Text.StringBuilder::NewBuilder(class System.String, int32)
4233 instance int32 System.String::get_Length()
- [Pnet-developers] XmlTextReader performance problems and ResX,
Marcus <=