flat assembler
Message board for the users of flat assembler.

Index > Main > fastest way of parsing strings?

Author
Thread Post new topic Reply to topic
SomeoneNew



Joined: 12 Aug 2006
Posts: 54
SomeoneNew
Hi guys

I would like to know whats the fastest (general purpose) way of parsing and handling strings.

I need basic operations (find, replace, etc) - Tried one of the libs I've found in this forums but it wasn't cutting it (against a benchmark with a hl language)...

Anyone know if its possible to read by chunks rather than going from one char to the other?, I'm working with ASCII data right now but I'd love to support UNICODE as well.

Thx!

_________________
Im new, sorry if I bothered with any stupid question Smile
Post 16 Jul 2007, 13:28
View user's profile Send private message Reply with quote
r22



Joined: 27 Dec 2004
Posts: 805
r22
reading by chunks is preferred.
The only problem is you need to make sure that your allocated string buffer has enough padding at the end.

Say you have a string "ABC" stored in a 3 byte long block of memory, IF you are reading 4 bytes at a time you're going to go outside of the buffer.

I optimized C library would work just fine for you, no sense in reinventing the wheel. I recall a few threads on this forum about an optimized StrLen function, but I'm not sure about a fully optimized String parsing library with unicode support.
Post 16 Jul 2007, 22:50
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
SomeoneNew: there are sooo many things to take into account. One major problem is whether string is static and dynamic. Static strings CAN be faster (often aren't in practice because of implementation), but they are way harder to use and have limited size. Dynamic strings are easy to use, not limited, but generally slower when enlarging. Note that nothing i mentioned here is nescessary, and in both cases it can be circumvented, problem is just it usually isn't. Smile

So the question i would really care about is: Is the string handling bottleneck of my application?

Quote:
but I'm not sure about a fully optimized String parsing library with unicode support.

For unicode support try ICU. Of course, the more complete unicode support you want, more HUNDREDS OF KILOBYTES are wasted.
Post 17 Jul 2007, 00:22
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
SomeoneNew



Joined: 12 Aug 2006
Posts: 54
SomeoneNew
hi thanks Smile
yes vid, it is a bottleneck. since i parse comma delimited text files and html!
Crying or Very sad

_________________
Im new, sorry if I bothered with any stupid question Smile
Post 17 Jul 2007, 22:28
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.