UNO sequence cleanup ...

Michael Meeks michael.meeks at collabora.com
Tue Sep 30 06:20:44 PDT 2014


Hi Matus,

	So - to confirm; Stephan and I discussed this, and there is interest in
improving things.

	Currently the uno::Sequence destructor (which reaches iDestructSequence
~34k times during startup with a sequence that has a ref-count > 1) -
goes via:

template< class E >
inline Sequence< E >::~Sequence()
{
    const Type & rType = ::cppu::getTypeFavourUnsigned( this );
    ::uno_type_destructData(
        this, rType.getTypeLibType(), (uno_ReleaseFunc)cpp_release );
}

	Which ends up in some wonderful type-informed way inside:

	cppu/source/uno/destr.hxx (idestructSequence)

	But it would be far more ideal to have:

template< class E >
inline Sequence< E >::~Sequence()
{
    if (!osl_atomic_decrement( &rSeq._pSequence->nRefCount ))
	doSomething () ...
}

	Where 'doSomething' is left as the exercise for the hacker there but
ideally in-lines to a very small method call =) Quite possibly we'll
need a new 

	In the -most- ideal world, we could trivially special-case these
uno::Sequence< sal_uInt8 > types (and other basic type sequences) and
just do an rtl_freeMemory (or whatever) in there.

	Anyhow - it'd be great if you could look into that as/when we get to
that item on the list :-) Quite possibly as a quick prototype hack; we
could just directly assign:

	rSeq._pSequence->nRefCount = 1;

	just before calling the destructData ;-) that's just a tad cheesy
though it'd be interesting to see the result on stripped code size
and/or startup perf.

	Thanks !

		Michael.

-- 
 michael.meeks at collabora.com  <><, Pseudo Engineer, itinerant idiot



More information about the LibreOffice mailing list