From: Nikolai Grigoriev (grig@renderx.com)
Date: Mon Mar 08 2004 - 00:32:04 PST
David,
> I use xep to transform an xml file to xsl-fo and then render the pdf,
> so i use xep to perform 2 steps. I was wondering if performance
> gains could be achieved by separating out the transform step?
For XEP 3.7.x, there is a chance to increase performance
if you do the transformation in a slightly different manner:
- make your transformer an XMLReader (e.g. by using
SAXTransformerFactory.newTransformerHandler(...);
- specify it as parser to create a SAXSource, and then pass
the result to FormatterImpl.render().
(This advice is applicable only to 3.7: we expect that XEP 3.8
will have the identical performance when called either way).
Additional tips:
1. Try not to call cleanup() too often. This method cleans up
internal caches for fonts and images, and subsequent calls
to the formatter will have to re-parse the fonts (which actually
takes quite a bit of time). If you are using a closed set of
images and fonts, than it is advisable to call cleanup()
only once, when the FormatterImpl object is disposed of.
2. FormatterImpl is a costly object, but it's thread safe.
Unless you need several different configurations simultaneously,
you can consider creating a single static instance, and access it from
several threads. You can easily create many FOTransformer
objects from a single Formatter: they don't interfere with each other.
(Please note that FOTransformer is reusable but _not_ thread safe:
it can transform several documents in sequence, but not in
parallel. This limitation is due to JAXP, and is outside our control).
> Perhaps I could use Xalan or Saxon to do the transform and
> pass xep the xslfo to render? I beleive xep uses JAXP...and
> maybe using another transformation engine (with freedom
> to optimise the engine) woudl help.
JAXP is just an interface, implemented by both Saxon and Xalan.
You can control which engine is picked by setting a system
property, javax.xml.transform.TransformerFactory, to the
class name of the desired implementation. Please also note
that FOTransformer can be constructed from a JAXP Transformer
object; you can pass an explicitly created Xalan or Saxon
implementation there.
Regards,
Nikolai Grigoriev
RenderX
-------------------
(*) To unsubscribe, send a message with words 'unsubscribe xep-support'
in the body of the message to majordomo@renderx.com from the address
you are subscribed from.
(*) By using the Service, you expressly agree to these Terms of Service http://www.renderx.com/tos.html
This archive was generated by hypermail 2.1.5 : Tue Mar 09 2004 - 00:25:58 PST