Re: Boost process and C
- From: websnarf@xxxxxxxxx
- Date: 4 May 2006 06:45:51 -0700
Flash Gordon wrote:
jacob navia wrote:
Flash Gordon a écrit :
Is an extra byte (or word, or double word) for a flags field really
that big an overhead?
Well, I have that extra "Flags" field in the string library of
lcc-win32. I have the size as a size_t as you propose, and I need 32
bits for the flags.
The problem is that 32 bits is quite a lot for a few bits info... For
programs that use extensively strings, 32 bits multiplied by several
thousand small strings can make a big difference in RAM used, specially
for the more common short strings.
I see the point of Bstrlib, and it is a very valid design decision.
I've yet to see software where short strings made up a significant
portion of the memory footprint and saving the memory that avoiding the
flags would be of real use. Of course, such applications might exist.
Any program that reads words from any language dictionary. Like a
spell checker, or a word puzzle solver/creator, or a spam filter. For
dictionaries the size of the english language dictionary, these kinds
of applications can typically push the L2 cache of your CPU pretty
hard.
Personally I would say that using negative lengths was asking for
problems because at some point a negative length will be checked without
first changing it to positive.
I think you miss the point. If the string length is negative then it
is erroneous. That's the point of it. But the amount of memory
allocated being negative, I use to indicate that the memory is not
legally modifiable at the moment, and being 0 meaning that its not
modifiable ever. The point being that the library blocks erroneous
action due to intentionally or unintentionally having bad header values
in the same test. So it reduces overhead, while increasing safety and
functionality at the same time.
You know, you can actually read the explanation of all this in the
documentation if you care to do so.
--
Paul Hsieh
http://www.pobox.com/~qed/
http://bstring.sf.net/
.
- Follow-Ups:
- Re: Boost process and C
- From: Flash Gordon
- Re: Boost process and C
- References:
- Re: Boost process and C
- From: websnarf
- Re: Boost process and C
- From: Ben Pfaff
- Re: Boost process and C
- From: jacob navia
- Re: Boost process and C
- From: Ben Pfaff
- Re: Boost process and C
- From: websnarf
- Re: Boost process and C
- From: CBFalconer
- Re: Boost process and C
- From: websnarf
- Re: Boost process and C
- From: CBFalconer
- Re: Boost process and C
- From: websnarf
- Re: Boost process and C
- From: Ben C
- Re: Boost process and C
- From: websnarf
- Re: Boost process and C
- From: Flash Gordon
- Re: Boost process and C
- From: jacob navia
- Re: Boost process and C
- From: Flash Gordon
- Re: Boost process and C
- Prev by Date: Re: Boost process and C
- Next by Date: Re: Incrementing a void pointer. Legal C99?
- Previous by thread: Re: Boost process and C
- Next by thread: Re: Boost process and C
- Index(es):
Relevant Pages
|