Michael Meeks wrote:
Hi Stephan,

        Switching to dev@ and CC'ing mhu/kr who I'm sure have lots of nice
ideas wrt. ustring.

[mhu/kr I'm pretty sure both read [email protected], so need to keep them on CC]

On Fri, 2006-08-25 at 09:50 +0200, Stephan Bergmann wrote:
        http://www.openoffice.org/issues/show_bug.cgi?id=68909
Instead of fixing those places (where lots of identical strings are alive simultaneously) locally and individually (by introducing a cache set in each of those places), maybe it would make sense to have one such cache globally that all those places use together:
[...]
        So - I think the real problem here is that it's easy to look at the
live strings in the quiescent state and say 90% of their space is
wasted, and only 10% is not duplicated, throwing up our hands in horror
etc. :-) -but- during startup we allocated 488,000 strings, of which
only (with patches) ~30,000 are left. The question is - is it worth
paying the cost for all string construction, and manipulation ? :-)

You got me wrong. I did not mean to suggest to automatically intern each string upon construction. ("Intern" being the act of replacing a string instance with a unique instance with identical content from the cache.) I still wanted to add intern calls in all the places where necessary, and merely have only one (singleton) implementation of intern().

[...]
        So - I -think- that focusing on configmgr is prolly a more fruitful use
of time just now than hashing all strings.

        Does that make sense ?

Yes, it seems we are in sync here (see above).

        Ah - also I meant to ask you: is it possible to construct arbitrary
'Any's ? ie. if I want to construct a type that has:

struct Foo {
        sal_Bool      bDynamic;
        sal_Int32     nDynamic;
        rtl::OUString aDynamic;
};

        dynamically, and then construct instances of this type - can that be
done ? [ an equivalent of the CORBA_dynany API I guess ]. I'd really
like that for fixing the rather inefficient configmgr storage, and API
elegantly. [ also, incidentally, if I return an 'Any' from a method, and
I want to type-cast it to eg. Sequence<Foo> - do I have to duplicate the
contents ? ].

You want to create a UNO type

  struct Foo {
    boolean bDynamic;
    long nDynamic;
    strign aDynamic;
  };

out of thin air and then use it in the UNO C++ language binding? Not doable easily, but should be doable in principle:

- com.sun.star.lang.TypeDescriptionManager is the UNO runtime type repository; you can extend it dynamically with com.sun.star.lang.TypeDescriptionProviers. However, unfortunately, the UNO Java runtime environment uses Java class files instead of the TypeDescriptionManager, so you would have to take that into account.

- The UNO functionality in com.sun.star.reflect (internally using com.sun.star.lang.TypeDescriptionMananger) should allow you to create instances of arbitrary UNO (struct) types.

-Stephan

        Thanks,

                Michael.

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

Reply via email to