zopefoundation/z3c.rml — pull request #4 by kylemacfarlane (2013-03-07 13:13:13+00:00)
Title: Some performance tweaks

1) One of the expected PDFs went missing again in cc4bca2 so I added that.

2) I added a ``.gitattributes`` so hopefully the PDFs don't get messed up again in transmission.

3) Made it so that ``getSampleStyleSheet`` is only called once. Apparently it was called for every ``para``.

4) Gave ``processStyle`` on ``Paragraph`` a similar tweak as the one on ``TableCell``.

5) ``getManager`` no longer calls ``interface.providedBy`` (which does a heap of checks) and instead just looks in the dictionary. Removing the check entirely speeds things up even more (especially for ``para``) and all tests still pass but I didn't go that far since I don't fully understand its purpose.

6) ``getAttributeValues`` now caches a signature's fields. Further improvements can be made by not doing ``attr.bind(self).get()`` if the attribute doesn't exist, but that causes a whole heap of issues with missing and default values. It's doable but will require small changes all over the place.

7) Unless the document is in debug mode turn off ``rl_config.shapeChecking`` to improve performance. Shape checking appears to be some kind of method of disallowing invalid attributes on objects in ReportLab, but since it does so many checks on every attribute that's set it slows things down quite a lot. I don't think someone using RML could even set invalid attributes anyway?

8) ``rl_fix.resetFonts`` no longer registers the fonts on every call. On Windows this meant the entire fonts directory and on all platforms it meant the Vera fonts. A huge improvement on Windows and a small improvement everywhere else. This could cause an issue on Windows if someone uses a font in their system directory but didn't register it in the RML.

9) ``etree.tounicode`` in the XML attributes is pretty slow. Adding ``pretty_print=False`` sped it up a little bit.

Even running ``bin/test`` is faster.

Without the windows font fix: 62.052s
With Windows font fix: 9.101s
With all fixes: 6.285s