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
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk

Reply via email to