[Libreoffice] Possible little code simplification
Ivan Timofeev
timofeev.i.s at gmail.com
Fri Nov 25 10:05:33 PST 2011
Hello Michael,
2011/11/25 Michael Stahl <mstahl at redhat.com>:
> On 24/11/11 19:07, Ivan Timofeev wrote:
>> [...]
>> What do you think about changing the code so that pSortedObjs will be
>> alive every time? We will be able to return a reference to pSortedObjs
>> in GetSortedObjs() instead of a pointer and remove the mentioned
>> checks (there are a lot of such checks). I could do this. :-)
>
> the writer core and layout code is highly optimized, especially for
> 16-bit windows where memory is scarce :)
Well, another possible memory optimization is to merge
SwSortedObjsImpl into SwSortedObjs. What is the reason to use the
"pImpl" pattern here?
> i guess for SwPageFrm it doesn't matter at all if the SwSortedObj always
> exists.
>
>> Same problem with the field 'SwSortedObjs* pDrawObjs' in the class SwFrm.
>
> since this is the base class of all frames there will be a couple more
> instances of it, and most of these probably won't use pDrawObjs; would
> be interesting to know how much memory this would uses for a large
> document...
Ok, there are many SwFrms in a big doc... We don't want to throw away
memory. But we would use a shared between the SwFrm instances static
variable for an empty list ("null object"), and return it in
GetDrawObjects when our SwSortedObjs is dead. What do you think about
it?
Kind Regards,
Ivan
More information about the LibreOffice
mailing list