Hello,
I'm trying the new intermediate format from the article
"Performance Analysis for Apache FOP's new Intermediate Format" of Jeremias
Märki.
and his program
(http://www.jeremias-maerki.ch/download/fop/FOP%20Benchmarks.zip).
Thanks to Jeremias.
So, I have write a small file.xml and a file xml2fo.xsl for the
transformation xml --> fo.
When I do a test with the FOPBenchmark,
I obtain a duration of 0,39 seconds! in the results.xml (with the variant
"from-it") :
<scenario name="xml2fo" variant="from-if">
<description>Apache FOP: file.xml example, rendering from Intermediate
Format</description>
<environment>
<value name="java.specification.version">1.6</value>
</environment>
<run idx="0">
<run>
<value name="target-format">PDF</value>
<page-count>2</page-count>
<duration>390</duration>
<file mime="application/pdf;mode=painter"
size="24294">file:/C:/Users/greg/workspace/FOPBenchmarks/benchmarks/dev/05/file.if.pdf.if.if.pdf
</file>
</run>
</run>
</scenario>
So, I take the class java bellow (for a program) :
public class Main {
public static void main(String[] args) {
FopFactory fopFactory = FopFactory.newInstance();
try {
long startTime = System.nanoTime();
File baseDir = new File(".");
File outDir = new File("out");
final File xmlfile = new File(baseDir, "xml/file.xml");
File xsltfile = new File(baseDir, "xsl/xml2fo.xsl");
File iffile = new File(outDir, "file.if.xml");
File stampxsltfile = new File(baseDir, "xsl/ifstamp.xsl");
File pdffile = new File(outDir, "file.if.pdf");
Main app = new Main();
// Setup output
OutputStream out = new java.io.FileOutputStream(pdffile);
out = new java.io.BufferedOutputStream(out);
try {
FOUserAgent userAgent = fopFactory.newFOUserAgent();
String mime = MimeConstants.MIME_PDF;
IFDocumentHandler targetHandler =
fopFactory.getRendererFactory().createDocumentHandler(
userAgent, mime);
IFUtil.setupFonts(targetHandler);
targetHandler.setResult(new StreamResult(pdffile));
IFParser parser = new IFParser();
Source src = new StreamSource(iffile);
Source xslt = new StreamSource(stampxsltfile);
TransformerFactory tFactory =
TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(xslt);
SAXResult res = new
SAXResult(parser.getContentHandler(targetHandler, userAgent));
transformer.transform(src, res);
} finally {
out.close();
}
long estimatedTime = System.nanoTime() - startTime;
System.out.println("estimatedTime : " + estimatedTime + "\n");
} catch (Exception e) {
e.printStackTrace(System.err);
System.exit(-1);
}
}
}
I can obtain a file.if.pdf (2 pages), but the transformation take 2.4
seconds !
I think it's very a long duration when I see <duration>390</duration> in my
results.xml !
Do you know why when I use a class java the duration is very long ?
What can I do for obtain a more small duration ?
Thank.
--
View this message in context:
http://old.nabble.com/Performance-Analysis-%28again-%3A%29-tp32317432p32317432.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]