Hi,

Inspired by the recent talk about optimizations, I have tried to look
for low hanging fruits that can speed up FOP, and as I expected I did not find any silver bullets.


On the other hand a series of smaller adjustments to the property
handling has improved the total processing time about 10%.

I have tested against a partial copy of "DocBook, The Definite Guide" that I translated to .fo with saxon-6.1.5. The input files that I used for timing can be found here:

http://bckfnn-modules.sf.net/DocBookDTG.zip

The modification I've implemented are:

- Switched from string based property names to integer enums.
  Most of the lookups then changed from get("font-size") to
  get(P_FONT_SIZE) and compound property lookup changed to
  get(P_SPACE_AFTER | C_OPTIMUM).
- Cached the non-contextdep default compound properties in the makers.
  This caching is similar to what already existed for the base
  properties.
- Calculated rel2abs and abs2rel in the property makers at codegen time
  to avoid string manipulation at runtime.
- Changed the element lookup in ProperyListBuilder.elementTable from
  using string keys to using integer enums.
- Copy the inherited property values from parent fo into the child
  fo. findProperty() is then no longer recursive.

The data structure that maps properties ids to the property object is an
sparse java array somewhat (AFAICT) similar to those in alt-design.
The indication of whether a property is explicit set is stored in a bit array.


Further optimizations:

- The PropertyManager stores a lot of properties in instance fields.
  Perhaps the properties in the PropertyList can be removed after the
  PropertyManager has taken what it needs. The remaining properties
  could then be packed more efficiently.
- The entire logic in findProperty() could be moved to the property
  makers. This could avoid 630.000 calls to the empty default methods
  in Property.Maker.


A compiled version of my changes can be downloaded here:


http://bckfnn-modules.sf.net/fop.jar

regards,
finn



Reply via email to