473,581 Members | 2,488 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Performance issues with XMLTextReader

Hi there,

I need to parse a lot of html-files from wikipedia, and I need to do it
as fast as possible. So I started a little testing with XMLTextReader,
but the results I get confuse me. It seems that the Reader ALWAYS needs
about 1 second for the first textReader.Read ()

Here's my testcode:

XmlTextReader _myReader = new XmlTextReader(t extBox1.Text);
DateTime _firstRead = DateTime.MinVal ue;

DateTime _start = DateTime.Now;
_myReader.Read( );
_firstRead = DateTime.Now;

while (_myReader.Read ())
{
}

MessageBox.Show ("FirstRead: " + Convert.ToStrin g(_firstRead - _start) +
". Overall: " + Convert.ToStrin g(DateTime.Now - _start));

And here are the results for a 134kb file:
FirstRead: 0.9218750. Overall: 0.9375

I get a similar result for a 15kb file. (And btw. the same result when
using DOM)

Any ideas why it takes so long for the first read and what to do about it?

I have downloaded the whole wikipedia and extract it to the filesystem.
Is that the reason?

Ciao,
Frank
Mar 8 '07 #1
2 2557
"Frank Schumacher" <f_********@inf ormatik.uni-leipzig.dewrote in message
news:uo******** ******@TK2MSFTN GP02.phx.gbl...
Hi there,

I need to parse a lot of html-files from wikipedia, and I need to do it as
fast as possible. So I started a little testing with XMLTextReader, but
the results I get confuse me. It seems that the Reader ALWAYS needs about
1 second for the first textReader.Read ()

Here's my testcode:

XmlTextReader _myReader = new XmlTextReader(t extBox1.Text);
DateTime _firstRead = DateTime.MinVal ue;

DateTime _start = DateTime.Now;
_myReader.Read( );
_firstRead = DateTime.Now;

while (_myReader.Read ())
{
}

MessageBox.Show ("FirstRead: " + Convert.ToStrin g(_firstRead - _start) + ".
Overall: " + Convert.ToStrin g(DateTime.Now - _start));

And here are the results for a 134kb file:
FirstRead: 0.9218750. Overall: 0.9375

I get a similar result for a 15kb file. (And btw. the same result when
using DOM)

Any ideas why it takes so long for the first read and what to do about it?

I have downloaded the whole wikipedia and extract it to the filesystem. Is
that the reason?
Which version of .NET are you running?

John
Mar 8 '07 #2
Hi John,
Which version of .NET are you running?
I'm working with Visual Studi 2005, so it is .NET 2.0, I guess.

Ciao,
Frank
Mar 9 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
3467
by: Brian Patterson | last post by:
I have noticed in the book of words that hasattr works by calling getattr and raising an exception if no such attribute exists. If I need the value in any case, am I better off using getattr within a try statement myself, or is there some clever implementation enhancement which makes this a bad idea? i.e. should I prefer: if...
5
4675
by: sandy | last post by:
Hi All, I am a newbie to MySQL and Python. At the first place, I would like to know what are the general performance issues (if any) of using MySQL with Python. By performance, I wanted to know how will the speed be, what is the memory overhead involved, etc during database specific operations (retrieval, update, insert, etc) when MySQL...
4
1889
by: Tomas Rivas | last post by:
I am trying to validate an xml file and schema and when I am trying to validate I am getting the following error. I have been trying to come out with a solution but I have failed so far. The document validates ok in xmlSpy but it fails in VS2003. Is there any article or fix for this? Thnaks in advance. Error: ======
4
11499
by: H Lee | last post by:
Hi, I'm an XML newbie, and not sure if this is the appropriate newsgroup to post my question, so feel free to suggest other newgroups where I should post this message if this is the case. I'm having issues using XmlTextWriter, saving it out to a file with UTF8 encoding, and seeing "dirty", or "human unreadable" characters show up *right...
115
7540
by: Mark Shelor | last post by:
I've encountered a troublesome inconsistency in the C-language Perl extension I've written for CPAN (Digest::SHA). The problem involves the use of a static array within a performance-critical transform function. When compiling under gcc on my big-endian PowerPC (Mac OS X), declaring this array as "static" DECREASES the transform throughput by...
9
12736
by: oafyuf | last post by:
Hi, I'm having performanbce issues with StreamReader and was wondering what I could do to improve it... The following takes around 3 seconds to process! The content of the response is: "<?xml version="1.0" ?><ERROR>ORA-01403: no data found</ERROR>" HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strURIQuery);
1
1919
by: George Durzi | last post by:
Folks, I'm running into some performance issues with my Xsl transformations. I've done a ton of debugging and digging around, and have come to the conclusion that the performance issues are NOT caused by slow stored procedures, or bad XSL/Ts. I came to this conclusion by doing a test transformation in client-side code instead of server side...
2
1409
by: Mark | last post by:
Hi... We've been doing some basic performance testing comparing asp, asp.net, mono, and php. One of the basic tests is on simply parsing an xml document and streaming the result back to the client. I never would have thought of it, but someone in our group had heard that using XmlDocument.Load (Server.MapPath (file)); was slower than...
14
755
by: ajfish | last post by:
Hi, I am trying to allocate a unique ID to every instance of tag 'foo' in a large XML document. currently I'm doing this: <xsl:variable name="UniqueId"> <xsl:number count="foo" level="any"/> </xsl:variable> but with .Net framework 1.1 (using XPathDocument) it is very slow for
0
7873
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7800
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8309
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7902
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8178
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5679
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
2304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1405
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1141
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.