473,406 Members | 2,312 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,406 software developers and data experts.

Fastest Thread-Safe XML Read

Looking for any input on the fastest and most thread-safe way to read
some small (~8k) XML files from a local disk.

System.Xml.XmlTextReader xReader =
new XmlTextReader( new System.IO.StringReader( configFile ) );
lock( xReader )
{
while ( xReader.Read() )
{
if ( xReader.Name == configKey )
{
string tmpString = xReader.GetAttribute( "user" );
}
}
}

I don't want any try-finally stuff, just thread-safe reading, it's OK
to block for a moment as long as other readers don't hit any
exceptions or errors.

Thanks.
Nov 11 '05 #1
3 3097
SteveC wrote:
Looking for any input on the fastest and most thread-safe way to read
some small (~8k) XML files from a local disk.

System.Xml.XmlTextReader xReader =
new XmlTextReader( new System.IO.StringReader( configFile ) );
lock( xReader )


I don't think this lock would help. It locks xReader objects, but each tread
is going to have it's own xReader object, right? So you have to lock something
more common.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2

Are you talking about something higher-level than the XmlTextReader or
lower-level like at the StringReader level?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 11 '05 #3
Ice
xReader should be a static variable - the actual class (method) can be
static.

ice
"SteveC" <st****@atomic9.net> wrote in message
news:88**************************@posting.google.c om...
Looking for any input on the fastest and most thread-safe way to read
some small (~8k) XML files from a local disk.

System.Xml.XmlTextReader xReader =
new XmlTextReader( new System.IO.StringReader( configFile ) );
lock( xReader )
{
while ( xReader.Read() )
{
if ( xReader.Name == configKey )
{
string tmpString = xReader.GetAttribute( "user" );
}
}
}

I don't want any try-finally stuff, just thread-safe reading, it's OK
to block for a moment as long as other readers don't hit any
exceptions or errors.

Thanks.

Nov 11 '05 #4

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

Similar topics

11
by: Simon | last post by:
Hi, If I have a string, (variable len), and I am looking for the first position of one char in array starting from position 'x' For example, // the 'haystack' $string = "PHP is great,...
9
by: Rune Strand | last post by:
Hi, If I have a lot of integers and want do something with each digit as integer, what is the fastest way to get there? Eg. Make 12345 into an iterable object, like or "12345" (Btw: What is...
4
by: laurenq uantrell | last post by:
I am trying to determine which of three stored procedure designs are fastest in the Query Analyzer: One query is a straight SELECT query with all desired rows and a dozen (tblName.RowName =...
5
by: Chris | last post by:
i am looking for the fastest way to insert several 1000 trx int oracle. is there a faster way, then using a DataAdapter? is there a possibilty to execute a bulk load (or batchwise insert with...
5
by: johannblake | last post by:
I need to copy all the data from a one dimensional byte array to a specific column in a two dimensional int array. For example: byte byteArray = {4, 5, 6}; int intArray = new int; After...
14
by: mesterak | last post by:
I want to very quickly count the number of lines in text files without having to read each line and increment a counter. I am working in VB.NET and C#. Does anyone have a very fast example on how...
44
by: Don Kim | last post by:
Ok, so I posted a rant earlier about the lack of marketing for C++/CLI, and it forked over into another rant about which was the faster compiler. Some said C# was just as fast as C++/CLI, whereas...
1
by: eric_berlin | last post by:
I am writing a multithreaded application that has 6 threads each writing 5 frames per second video bitmaps to a different picture box. I have just found out that only the main UI thread is supposed...
6
by: Niyazi | last post by:
Hi all, What is fastest way removing duplicated value from string array using vb.net? Here is what currently I am doing but the the array contains over 16000 items. And it just do it in 10 or...
22
by: SETT Programming Contest | last post by:
The SETT Programming Contest: The fastest set<Timplementation Write the fastest set<Timplementation using only standard C++/C. Ideally it should have the same interface like std::set. At least...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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
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...
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.