Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Strings and header reuse

4 views
Skip to first unread message

Dan Sugalski

unread,
Feb 17, 2003, 9:42:00 AM2/17/03
to perl6-i...@perl.org
One of the things that's been pending as a potential performance
bottleneck is the use and reuse of string headers. Leo's been
prodding me on this one, as it really needs addressing, either to
canonicalize the current method of doing things or to put in place
some alternate structure.

For those of you who've not been following along at home, the problem
is that almost all the string functions that produce modified strings
do it in new string headers. That's fine, since it's often what you
want, but what we don't have is a way to reuse existing string
headers, which is also often what you want. Since we force the
creation of new headers for most string operations, we're generating
a lot of garbage.

Generating lots of constant strings would be fine if we were going
with a purely immutable string scheme, which'd make multithreading a
bit better, but we're not since mutable strings make the unshared
string case faster. Since we're losing the multithreading advantages
anyway, we'd be better off taking as much advantage of mutability as
we can. There's the potential for some confusion in hand-written
assembly, but I'm not really worried about that--most assembly's
going to be compiler-generated anyway, and we managed this somehow
back in the Old Days... :)

What we need to do now is go through the opcodes and PMC interfaces
and define what returns copies of strings, what takes control of
passed in strings, what reuses existing string headers, as well as
adding in a set of string functions that take destination string
headers. (I'm pretty sure we can rejig the existing functions some,
and redo the existing string functions as a set of wrappers that
allocate and pass in new string headers)

This should be mostly a matter of some thought and
documentation--I'll get started on it ASAP so we can make the changes
quickly and get this out of the way once and for all.
--
Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

Robert Spier

unread,
Feb 17, 2003, 2:44:34 PM2/17/03
to perl6-i...@perl.org

> documentation--I'll get started on it ASAP so we can make the changes
> quickly and get this out of the way once and for all.


Famous Last Words!(tm)

-R

Leopold Toetsch

unread,
Feb 17, 2003, 3:16:43 PM2/17/03
to Robert Spier, perl6-i...@perl.org
Robert Spier wrote:


You mean:
"GC quick note"

One thing that might help the GC situation some.

Since we've got mutable strings (yep, it's OK) perhaps we should
thump the string functions a bit to not allocate new strings quite so
often. That'll leave us fewer headers to worry about.
--
Dan


> -R


SCNR,
leos


0 new messages