473,769 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I/O stream performance

Dear Sir,

I have many small XML files contain all kind of data, very often, I need to
get a summary of the XML file and show part in a repeater control...

For example... I have 10 xml files in one folde.. 1.xml, 2.xml, 3.xml,
....... 10.xml.

Every XML file contains a summary tag and a detail list. for example..
*************** *************** ************
<xml>
<summary>
there are some text here
</summary>
<details>
<detail id=2>some contentssfasfsd . sfsafs.s fsdfsdf
</detail>
<detail id=5>dsfdsfsd </detail>
</details>
*************** *************** *************

I can read the XML into a dataset, then get the first summary part. However,
this will cause a lot of I/O overhead. What should I to only read the first
part (<summary>.... </summaryof those XML files?

I actually need to all those files (10 XML file in this case), get the
summary part of every file, add it to a arraylist and bind to a repeater
control.

Thanks in advanced...

Guoqi Zheng
Sep 5 '06 #1
2 1024
Rob
Guoqi,

If the files are very small, under 512 bytes, then what you are asking is
impossible. The operating system reads/writes files in blocks of 512 (and at
the actual device driver/file system level it is probably dealing with 4K
chunks... essentially the allocation size for the file system).

If the files are larger than 512 bytes you might be able to save some IO
cycles... but unlikely. More or less open the file read 512 bytes, then try
and match on <summary>*</summary(maybe using RegEx).

But... it looks like a database may be more appropriate structure (exactly
how many is "I have many small xml files"... if it is several hundred...
well... that sounds like a database is needed).

Or perhaps at least some sort of cache so the files are in memory (but if
you have lots and lots of these then this is not likely a good answer
either).

Regards,

Rob
"Guoqi Zheng" <no@sorry.comwr ote in message
news:ON******** ******@TK2MSFTN GP03.phx.gbl...
Dear Sir,

I have many small XML files contain all kind of data, very often, I need
to get a summary of the XML file and show part in a repeater control...

For example... I have 10 xml files in one folde.. 1.xml, 2.xml, 3.xml,
...... 10.xml.

Every XML file contains a summary tag and a detail list. for example..
*************** *************** ************
<xml>
<summary>
there are some text here
</summary>
<details>
<detail id=2>some contentssfasfsd . sfsafs.s fsdfsdf
</detail>
<detail id=5>dsfdsfsd </detail>
</details>
*************** *************** *************

I can read the XML into a dataset, then get the first summary part.
However, this will cause a lot of I/O overhead. What should I to only
read the first part (<summary>.... </summaryof those XML files?

I actually need to all those files (10 XML file in this case), get the
summary part of every file, add it to a arraylist and bind to a repeater
control.

Thanks in advanced...

Guoqi Zheng


Sep 5 '06 #2
Rob,

Thanks a lot for your answer...

I have millions, millions of those small text file... The size normally
about 4kb-10kb, some times it can be up to 100kb... My pc always format
using the 512 bytes allocation.

Do you think I gain some performance by using readbyte and convert to
string, check the <summarytag first?

Thanks a lot...

"Rob" <rmacfadyen_at_ gmail.com>
??????:uc****** ********@TK2MSF TNGP06.phx.gbl. ..
Guoqi,

If the files are very small, under 512 bytes, then what you are asking is
impossible. The operating system reads/writes files in blocks of 512 (and
at the actual device driver/file system level it is probably dealing with
4K chunks... essentially the allocation size for the file system).

If the files are larger than 512 bytes you might be able to save some IO
cycles... but unlikely. More or less open the file read 512 bytes, then
try and match on <summary>*</summary(maybe using RegEx).

But... it looks like a database may be more appropriate structure (exactly
how many is "I have many small xml files"... if it is several hundred...
well... that sounds like a database is needed).

Or perhaps at least some sort of cache so the files are in memory (but if
you have lots and lots of these then this is not likely a good answer
either).

Regards,

Rob
"Guoqi Zheng" <no@sorry.comwr ote in message
news:ON******** ******@TK2MSFTN GP03.phx.gbl...
>Dear Sir,

I have many small XML files contain all kind of data, very often, I need
to get a summary of the XML file and show part in a repeater control...

For example... I have 10 xml files in one folde.. 1.xml, 2.xml, 3.xml,
...... 10.xml.

Every XML file contains a summary tag and a detail list. for example..
************** *************** *************
<xml>
<summary>
there are some text here
</summary>
<details>
<detail id=2>some contentssfasfsd . sfsafs.s fsdfsdf
</detail>
<detail id=5>dsfdsfsd </detail>
</details>
************** *************** **************

I can read the XML into a dataset, then get the first summary part.
However, this will cause a lot of I/O overhead. What should I to only
read the first part (<summary>.... </summaryof those XML files?

I actually need to all those files (10 XML file in this case), get the
summary part of every file, add it to a arraylist and bind to a repeater
control.

Thanks in advanced...

Guoqi Zheng



Sep 6 '06 #3

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

Similar topics

4
2977
by: Leon Jollans | last post by:
Hi. I'm reading a 5 meg (or so) file from the response stream of a WebRequest, and it's pitifully slow. I mean *really* slow, in the order of 15 minutes to download. Now obviously I'm caching this on the client (Windows app / IsolatedStorage), but I can't have it taking this long to download in the first instance. We've got Gigabit LAN. what's the bottleneck? I could make the resource available via a different protocol / means if...
24
2762
by: Hendrik Schober | last post by:
Hi, I have a 'std::istream' and need to read its whole contents into a string. How can I do this? TIA; Schobi
6
3709
by: Ian Robertson | last post by:
I am trying to write a function that takes a reference to an object as its arguement. The object is created in another function and I am trying to pass the object to another function from within the function that created the object. I have cut out some code as I dont think showing a for loop is helpful. void TMP3_Main_Form::LoadMP3() { TMemoryStream *MP3Stream = new TMemoryStream();...
15
2221
by: Adam H. Peterson | last post by:
I would like to make a stream or streambuf that tracks the number of lines that have been read and stuff like that (so, for example, when I get an error message, I can ask the stream for the line number and put it in error messages. I tried to create a streambuf class that held an instance of another streambuf (through parameterized inheritance) and would ferry calls from the one to the other, tracking data as it was read, but I wasn't...
8
3891
by: Roberto Rocco | last post by:
Hello, I have a struct and want to stream it to a file (binary). I cannot use because this is not supported under the Compact Framework. What is the best approach to use? Another question in this aspect: How to I retrieve the size of my stuct? SizeOf seems not to work on structs? Many thanks in advance, Roberto.
0
1162
by: David Purton | last post by:
Hi, I have some ASP code to stream a binary file. It works well and looks something like the original ASP code shown below. I'm experimenting in creating ZIP files on the fly and am trying to come up with good ways of streaming binary files using ASP.NET, but I'm having performance issue. The new ASP.NET code is also shown below. The performance of this is *terrible*. I get less than 200 KB/s across a LAN. The original code gives a...
7
9994
by: Lee | last post by:
Hi, I'm a stream virgin and am attempting to output strings to a file. My approach is to write the string initially to a 'stringstream' and only when complete write the stringstream to the file (ofstream). The process works fine however appears to be rather slow. For example outputting about 2Mb of data takes a couple of minutes (most of the time appears to be writing to the stringstream) and as I'm creating several hundred files in...
10
3168
by: m00nm0nkey | last post by:
Hello. I am trying to split a file with 334,386 lines into seperate files of 50,000 each. This is the code i am running: Dim intFragmentRawIndex As Integer Dim swRawDataFile As StreamWriter Dim intNewRawIndex As Integer Dim strNewRawDataFileName As String Dim intFragmentCallCount As Integer = 0
4
2336
by: Scott F. Brown | last post by:
Greetings all... I was playing around with compressing streams and came across a behavior that I do not understand. I create a stream (input) from the contents of a textbox. That stream is compressed into another stream (output). I then copy the stream (output) to another stream (input2). The compressed stream (input2) is then decompressed into a final stream (output2). My question is this. I create input2 from output.GetBuffer()...
7
9899
by: iporter | last post by:
I use the code below to authorise the download of certain files. Thus, instead of linking to the file in a wwwroot directory, I link to this code with the filename as a parameter, and the script streams the file if the user is authorised. This has worked fine on PDFs, DOCs, XLS, etc. until today, and 18MB file presents the error message 'format error: not a pdf or corrupt'. Is there a file size limit, or a default that needs...
0
9586
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9990
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3956
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
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.