473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 1010
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.comwrote in message
news:ON**************@TK2MSFTNGP03.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**************@TK2MSFTNGP06.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.comwrote in message
news:ON**************@TK2MSFTNGP03.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
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...
24
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
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...
15
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...
8
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...
0
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...
7
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...
10
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...
4
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...
7
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...

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.