Hi Michael,

Michael Meeks wrote:
[...]
        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)
       const rtl::OUString& rtl::OUString::fromCName(const char *foo)
Since those strings will be unique and must exist, it seems better, no ?
        [ 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.
You're damn right. I have made a something quite similar on nagios, the result was a 5 times faster responsiveness (!). I don't expect this kind of optimization on OOo to go so far, but it can _greatly_ improve global boot time, too. You're optimization is a good example of this C technique :
http://en.wikipedia.org/wiki/Resource_acquisition_is_initialization
        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 ?
   Glib has a nice premade one, g_hash_table, or something like that.

My 2 euro cents,


Regards,
--
Michel Loiseleur

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

Reply via email to