[MUD-Dev] [TECH] String Classes, Memory Management, and Fragmentation
ddt at discworld.imaginary.com
Tue Jul 10 19:58:58 New Zealand Standard Time 2001
On Tue, 10 Jul 2001, Chris Dern wrote:
> I actually would be interesting in knowing more about your
> implementation and the impetus behind your design choices. What
> guaranties does the CLR make for construction time on a string?
> I'm guessing a long running service with a collection of strings,
> could slowly impact the time to find a string. I'm guessing you
> implement some sort of hash table of pointers into the linear
> memory area. Can you provide what (i'm guessing there are lots of
> them) implementation optimizations you do/can make given an
> immutable string?
LPmud/mudos uses a shared string table just as you suggest. They do
some optimisations like in some places they don't bother using the
string tabvle if it is a temporary string that is going to be
immediately thrown away.
They also do things like expanding the hash table and reworking the
hash when the array gets too large. Another problem with string
hash tables is computing the hash for the entire string is a real
problem (or can be if the string is too long).
There are a bunch more optimisations, if you get the string table
stuff out of the latest mudos driver (http://www.mudos.org) you
should get quite a few pointers though.
MUD-Dev mailing list
MUD-Dev at kanga.nu
More information about the MUD-Dev