[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: null terminated strings
From: |
Ken Anderson |
Subject: |
Re: null terminated strings |
Date: |
Mon, 19 Jan 2004 12:28:59 -0500 |
At 01:06 PM 1/16/2004 -0800, Tom Lord wrote:
> > From: address@hidden (Paul Jarc)
>
> > FWIW, I think that (preferably copy-on-write) shared substrings are
> > valuable enough for performance
>
>mutation-effects-both shared substrings are valuable as a feature of
>(extended) Scheme.
>
>A common idiom in string-manipulating programs is to manipulate and
>pass around triples (STRING START END).
>
>It's well worthwhile to make such triples a first-class type -- the
>alternative is to have to write lots of string manipulation functions
>in a style where they take three actual parameters (ideally with two
>of those being optional) to represent a single conceptual parameter.
>
>And if you have that abstract data type, since it is compatible with
>the RnRS requirements for the STRING? type, it may as well be a subset
>of the STRING? type.
>
>copy-on-write shared substrings are a performance feature --
>mutation-effects-both shared substrings are an improvement to Scheme.
Can you describe how this is an improvement to Scheme? I don't think i've ever
wanted to do this. In Java, which does copy-on-write i often find myself
carefully copying the substrings so they don't share structure. This is
because of things like:
- i don't know how long the underlying string (char array actuall) is. It can
be much longer than the last line i've read.
- many fields are a relatively small set of values so interning them helps.
- some fields become something besides strings, such as numbers.
Java only has one kind of string, which is fairly heavy weight. For example,
the string "" takes 36 bytes:
> (describe "")
is an instance of java.lang.String
// from java.lang.String
value: address@hidden
offset: 0
count: 0
hash: 0
So, it might help to have several representations for strings. In Gule, of
course, you can play even more games because you have C underneath.
From the applications i've seen, interning strings has been more useful
- Re: argz SMOB, (continued)
- Re: argz SMOB, Paul Jarc, 2004/01/15
- null terminated strings (was: argz SMOB), Andreas Voegele, 2004/01/16
- Message not available
- Re: null terminated strings, Andreas Voegele, 2004/01/16
- Re: null terminated strings, Roland Orre, 2004/01/16
- Re: null terminated strings, Andreas Voegele, 2004/01/16
- Re: null terminated strings, Brian S McQueen, 2004/01/16
- Re: null terminated strings, Paul Jarc, 2004/01/16
- Re: null terminated strings, Tom Lord, 2004/01/16
- Re: null terminated strings, Paul Jarc, 2004/01/16
- Re: null terminated strings, Roland Orre, 2004/01/16
- Re: null terminated strings,
Ken Anderson <=
- Re: null terminated strings, Per Bothner, 2004/01/19
- Re: null terminated strings, Ken Anderson, 2004/01/19