Thanks very much for your help!!! I have managed to enhance performance drastically by turning off the FOP logging messages. Thanks a ton!
Jeremias Maerki-2 wrote: > > The log output can indeed account for most of the performance loss. But > that's easy to fix: just configure your preferred log subsystem so that > only warnings and errors are generated. > > Please also note that the first rendering run is always the slowest as > class loading and just-in-time compiling is occuring. Using modern JVMs > can also improve performance a lot. > > See here for more info: > http://xmlgraphics.apache.org/fop/0.94/embedding.html#basic-logging > http://xmlgraphics.apache.org/fop/0.94/embedding.html#performance > http://xmlgraphics.apache.org/fop/0.94/embedding.html#object-reuse > > On 05.03.2008 06:43:11 xsltuser wrote: >> >> Dear All, >> >> Below is the snippet of code I'm using to do XML -> XSL-FO -> PDF >> conversion. The problemmatic statement is transformer.transform(src, >> res); >> which is taking 20-25 secs to execute which is not acceptable to the >> business. I'm using FOP - 0.94 >> >> // Setup directories >> File baseDir = new File("."); >> File outDir = new File(baseDir, "out"); >> outDir.mkdirs(); >> >> // Setup input and output files >> File xmlfile = new File(baseDir, "xml/xml/projectteam.xml"); >> File xsltfile = new File(baseDir, >> "xml/xslt/projectteam2fo.xsl"); >> File pdffile = new File(outDir, "ResultXML2PDF.pdf"); >> >> // configure fopFactory as desired >> FopFactory fopFactory = FopFactory.newInstance(); >> >> FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); >> // configure foUserAgent as desired >> >> // Setup output >> OutputStream out = new java.io.FileOutputStream(pdffile); >> out = new java.io.BufferedOutputStream(out); >> >> try { >> // Construct fop with desired output format >> Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, >> foUserAgent, out); >> >> // Setup XSLT >> TransformerFactory factory = >> TransformerFactory.newInstance(); >> Transformer transformer = factory.newTransformer(new >> StreamSource(xsltfile)); >> >> // Set the value of a in the stylesheet >> transformer.setParameter("versionParam", "2.0"); >> >> // Setup input for XSLT transformation >> Source src = new StreamSource(xmlfile); >> >> // Resulting SAX events (the generated FO) must be piped >> through to FOP >> Result res = new SAXResult(fop.getDefaultHandler()); >> >> // Start XSLT transformation and FOP processing >> transformer.transform(src, res); >> } finally { >> out.close(); >> } >> >> Application logs display series of below messages during transformation >> (which presumably taking bulk of the time) >> >> 2008-03-05 10:04:08,375 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-family, fo:table-cell >> 2008-03-05 10:04:08,382 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-family, fo:table-row >> 2008-03-05 10:04:08,387 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-family, fo:table-body >> 2008-03-05 10:04:08,393 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-family, fo:table >> 2008-03-05 10:04:08,400 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-family, fo:table-cell >> 2008-03-05 10:04:08,406 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-family, fo:table-row >> 2008-03-05 10:04:08,414 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-selection-strategy, fo:block >> 2008-03-05 10:04:08,419 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-selection-strategy, fo:table-cell >> 2008-03-05 10:04:08,423 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-selection-strategy, fo:table-row >> 2008-03-05 10:04:08,429 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-selection-strategy, fo:table-body >> 2008-03-05 10:04:08,436 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-selection-strategy, fo:table >> 2008-03-05 10:04:08,441 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-selection-strategy, fo:table-cell >> 2008-03-05 10:04:08,449 [StaticCacheThread-4] DEBUG (PropertyMaker.java: >> 254) - PropertyMaker.findProperty: font-selection-strategy, fo:table-row >> >> Any help in this regard is greatly appreciated >> >> Thanks, >> Charanpreet. >> -- >> View this message in context: >> http://www.nabble.com/Poor-Performance-of-JAXP-transformer-on-passing-FOP-handler-tp15843663p15843663.html >> Sent from the FOP - Users mailing list archive at Nabble.com. >> > > > Jeremias Maerki > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Poor-Performance-of-JAXP-transformer-on-passing-FOP-handler-tp15843663p15846640.html Sent from the FOP - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
