On Nov 22, 2006, at 13:30, [EMAIL PROTECTED] wrote:

Hi Richard,


I've been experiencing a couple of problems lately regarding
speed and memory usage when generating some large fop reports
(around 42MB .fo) Having run Hat on the hprof dump and taken
a closer look at the code I see an awful lot of objects which
don't appear to serve any useful purpose. e.g. ~38000 instances
of CommonAural, CommonAccessibility, etc. which are never used.

It seems like almost every class in the fo tree is storing
redundant properties. Is there any reason why I shouldn't
remove the worst offenders and submit the appropriate patch?

Interesting info, and it somewhat confirms my suspicions... although we need to take care: just because they are currently not effectively used in the process doesn't mean that they are completely superfluous or redundant. Just because we currently don't have a renderer for which the CommonAural properties make sense, does not mean we never will incorporate such a renderer into FOP. If we ever do, those properties will have to be re-introduced anyway...

OTOH, if you feel like investigating further, I personally would be very interested to see if the properties implementation cannot be optimized in other ways than simply removing them as members from the FOs.

I recently mentioned the idea of flyweights. Take for example a property for 'font-size="10pt"'. In the current implementation, if this property occurs on a thousand different FOs, there will be exactly as many Property instances created for it, while this could be reduced to one. All the related FOs can then share a reference to that one single instance. We would add a little overhead, since for each property we'd need to check if an instance with the exact same property value is already present in the pool... but this small overhead would drastically reduce the memory usage IIC.


Cheers,

Andreas

Reply via email to