Dan Sugalski wrote: > So, let's do this: > > 1) We'll add allocate_string and reallocate_string functions, which > the strings use. It'll give us COW space at the end of the string > data. > > 2) We'll add in new_*_const_header to match the new_*_header > functions, to allocate String/Buffer/PMC headers from constant header > arenas rather than from the default arenas > > 3) We'll add in (re)?allocate_const functions to allocate memory from > constant pools rather than the default collectable pools. > > 4) We'll add in COW functionality for strings and see what sort of > win we get. (I'm not sure that we'll win much with general COW, since > my gut feeling is that most COW strings will have a constant string > as their source, but I could be wrong here. That'd be OK)
I'll make a start on this on Monday, but it may take a few days to get it all in place. I will probably post it as a series of patches, rather than trying to do (break?) it all at once. Does anybody have any thoughts on adding a new function in string.c to return the pointer to the start of the string, so all access to the innards of a STRING struct can be restricted to string.c? This would mean the logic to access a COWed substring would be confined to one place. After the introduction of string_to_cstring, there are very few places that access s->bufstart directly anyway. -- Peter Gibbs EmKel Systems