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
Famous Last Words!(tm)
-R
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