Hi
there,
I'm working with the
Sablotron 0.44 performance... and found out that most of the time it is spending
on allocating little trunk of memory for small string and for appending small
strings...
To speed up the
performance in this area, I have implement a new string class, which replaced
both existing DStr and Str classes. The idea is as follows:
Each Str object will
now contains a pre-allocated buffer of size 1K (customizable in the source code,
but 1K is the optimal so far to avoid stack overflow)... Any string
assignment/append with work with this buffer unless it caused an overflow, and
in that case, a dynamic allocated buffer will be used. The size of the dynamic
allocated buffer is round up to the nearest 4K (again, customizable in the
source code), and again, any string concatenation will be done within the same
buffer, and will be "reallocated" to a bigger size when a bigger one is
need.
I have run some
performance testing against the release/optimized version, and the result
are:
a small one (xml ~90K and xsl ~80K) which took 1050ms before is now takes only 800ms
a medium size one (xml ~ 300K and xsl ~80K) improved from 2200ms to 1800 ms
a small one (xml ~90K and xsl ~80K) which took 1050ms before is now takes only 800ms
a medium size one (xml ~ 300K and xsl ~80K) improved from 2200ms to 1800 ms
(i.e., the average
is around 20% improvement).
Since
I'm new to this mailing list, could anyone let me know what is the
procedure/steps to follows for this kind of changes? Or how can I submit the
changes in order to get accepted/approved by the
group?
Also, I believed the
following is a bug in datastr.cpp:
int
Str::compare(const char* otherChars) const
{
return (strcmp(operator char*(), otherChars) < 0);
}
{
return (strcmp(operator char*(), otherChars) < 0);
}
which I believed it
should be:
int
Str::compare(const char* otherChars) const
{
return (strcmp(operator char*(), otherChars));
}
{
return (strcmp(operator char*(), otherChars));
}
Thanks in advance
for your help.
William
Lee
datastr.cpp