Hi Kay,

On Thu, 2006-08-31 at 18:15 +0200, Kay Ramme wrote:
> would you mind to reiterate the potential / real savings and costs for 
> me? Admitting that I have not understand your explanations the first 
> time ... ;-)

        Sure; simple enough. My analysis of duplicate strings (for a quiescent
writer) is here:

        http://go-oo.org/~michael/ustrings.ods

        It shows >90% of our OUStrings (by memory used) are duplicates of other
OUStrings - so we're burning >1Mb here pointlessly. I've been going
around fixing some of the specific worst-offenders here.

        In many cases these are plain-and-simple ASCII constants used as cnames
to denote fields, property names etc. These are typically constructed
with the normal RTL_CONSTASCII_VERYLONGMACRONAME("foo") type
constructors, which generates a new copy every time, hence the
duplication.

        The proposal is to use an always-growing, non-aged, hash of such common
strings; and a nice constructor something like:

        rtl::OUString rtl::OUString::fromCName(const char *foo)

        [ or whatever ], that will avoid the need for ugly macros (we have to
iterate to hash the string anyway), and will return the same value as
last time.

        Performance wise this should ~always be a win: of course we need to do
1 hash lookup, (with a lock taken I guess), but the current situation of
expensive memory allocation, copying etc. is no doubt rather slower.
And, of course - we can save again when doing comparisons 1st by pointer
value.

        We'd need a simple hash table impl. in sal/ though that'd be fairly
easy to hack up [ it'd be hard to produce something worse than stl's
effort ;-]. What do you think ?

        Regards,

                Michael.

-- 
 [EMAIL PROTECTED]  <><, Pseudo Engineer, itinerant idiot


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to