The COW patch has been revised for minimal impact to the outside world.
The only files changed are: resources.h, resources.c, string.h, string.c
There is one API change: Parrot_reallocate_string has an additional
parameter. However, nobody outside string.c really has any business calling
that anyway; and currently nobody else does.

The STRING structure has one change: a new field, void *buffer, points to
the start of the physical buffer allocation.
I tested a version that eliminated this requirement, by placing the
allocated buffer length in the string tail; but this made the code in
compact_string_pool very cumbersome, and the performance was several percent
slower than my current implementation.

Once the latest memory management patch is in, I will resync and submit the
COW code as a separate patch, and we'll see what everybody thinks about it.

I have just done a benchmark using Melvin's reverse.cola program.
Reversing string.c went from 3.42 user seconds down to 3.12 with the COW
patch; while reversing core_ops.c went from 94.39 to 92.26. Since this
program does a large amount of stack manipulation, I suspect that the much
smaller percentage improvement achieved on the larger file is due to stack
overhead - I haven't had a change to profile it yet, but I will do as soon
as I can.

Unrelated subject: I see that Steve has modified string.c to get around the
problem with the temporary transcoded strings - I believe we need to
finalise a standard way of handling these situations soon. If anybody is
interested, I will resync my previous 'neonate' patch - it needs a bit of
work to fit with the latest changes to resources.c

--
Peter Gibbs
EmKel Systems


Reply via email to