473,473 Members | 1,552 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Fast String Processing in .NET

Hi,

Consider a server which receives delimiter based string data from client.

It needs to process this data very fast.

Now if its built in C++, one obvious idea would be to put the string on heap
as char* and then pass the pointer around, delimiter separated fields will
be accessed via pointers as well ( <map> of pointers to fields ). this will
mean that there is no extensive performance nor memory consumption.

So how this can be done in the most performance friendly way in .NET

Please let me know if there is more info req on the problem ( this is based
on a real life problem )

Thank you in advance
rawCoder
Nov 17 '05 #1
4 3333
Use your MSDN and Search for StringBuilder.

"rawCoder" <ra******@hotmail.com> wrote in message
news:er**************@tk2msftngp13.phx.gbl...
Hi,

Consider a server which receives delimiter based string data from client.

It needs to process this data very fast.

Now if its built in C++, one obvious idea would be to put the string on
heap
as char* and then pass the pointer around, delimiter separated fields will
be accessed via pointers as well ( <map> of pointers to fields ). this
will
mean that there is no extensive performance nor memory consumption.

So how this can be done in the most performance friendly way in .NET

Please let me know if there is more info req on the problem ( this is
based
on a real life problem )

Thank you in advance
rawCoder

Nov 17 '05 #2
StringBuilder doesnt exactly provide what i am looking for.
It does provide super fast concatenation and mutability but what I really
need is something like referencing substrings inplace.

rawCoder
Nov 17 '05 #3
AFAIK you could also access this a an array of chars, as a stream or even
using pointers...

You'll have likely to do some testing to select the appropriate method.

Patrice

--

"rawCoder" <ra******@hotmail.com> a écrit dans le message de
news:uZ**************@TK2MSFTNGP14.phx.gbl...
StringBuilder doesnt exactly provide what i am looking for.
It does provide super fast concatenation and mutability but what I really
need is something like referencing substrings inplace.

rawCoder

Nov 17 '05 #4
rawCoder wrote:
Consider a server which receives delimiter based string data from
client.

It needs to process this data very fast.
I always find such statements to be suspicious. This is the same as saying
"as fast as possible", which, given an infinite amount of development time,
could be quite fast. But no project will support an infinite amount of
development time.

If this is your requirement, change it to something concrete, like "must
process strings from sample data set X with an average time of 12 ms and a
maximum time of 50 ms" or something similar. If this is someone elses
requirement, get them to clarify it in a similar manner.

This allows you to determine when this requirement has been met and when you
can move on to other requirements such as scalability and robustness.
Now if its built in C++, one obvious idea would be to put the string
on heap as char* and then pass the pointer around, delimiter
separated fields will be accessed via pointers as well ( <map> of
pointers to fields ). this will mean that there is no extensive
performance nor memory consumption.

So how this can be done in the most performance friendly way in .NET


Well, for one thing, "in .NET" would include Managed C++ where you could do
this precisely as you've stated.

Secondly, presuming you want to use one of the libraries, I would start with
the Regex library. If you can define your text processing in terms of that,
you likely would find very good performance, given a precompiled RegEx
expression.

http://msdn.microsoft.com/library/de...classtopic.asp

(tiny version:)

http://tinyurl.com/9s84v
Thirdly, if that still isn't good enough, you may want to step back into
(Managed) C++ and look into using the Spirit parser.

HTH

--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
Nov 17 '05 #5

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

Similar topics

4
by: rawCoder | last post by:
Hi, Consider a server which receives delimiter based string data from client. It needs to process this data very fast. Now if its built in C++, one obvious idea would be to put the string on...
6
by: Cable | last post by:
Hello, I am hoping that someone can answer a question or two regarding file access. I have created an app that reads an image from a file then displays it (using OpenGL). It works well using...
6
by: G.Esmeijer | last post by:
Friends, I would like to read a text file (fixed length formaated) really fast and store the data into an Access database (2003). Using the streamreader and reading line by line, separating the...
10
by: Brent | last post by:
I'm quickly running out of available db connections with the code below. I like to think I'm closing everything as I go along, but I watch the connections shoot up as soon as the the method getIDs...
4
by: Alexis Gallagher | last post by:
(I tried to post this yesterday but I think my ISP ate it. Apologies if this is a double-post.) Is it possible to do very fast string processing in python? My bioinformatics application needs to...
4
by: Jean-François Blais | last post by:
Many must have asked that question. I intend to write a few programs which will be CPU intensive. I know a little of Java. Would a language that yields native code, instead of bytecode perfrom much...
15
by: Michael A. Covington | last post by:
Any thoughts about how to implement image processing algorithms to run fast in C#? Using GetPixel to access every pixel from a Bitmap seems to be rather time-consuming.
4
by: cyberdaemon | last post by:
Hi all, ok I have this problem where I need to process 50,000+ records from three different tables on two different servers thus 150,000+ records. Now I have got this program to work, however, it...
7
by: Karch | last post by:
I need to find the fastest way in terms of storage and searching to determine if a given string contains one of a member of a list of strings. So, think of it in terms of this: I have a string such...
9
by: Salad | last post by:
I have access, for testing at my client's site, a Win2000 computer running A2003 retail. He recently upgraded all of his other machines to DualCore Pentiums with 2 gig ram and run A2003 runtime. ...
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
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
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.