xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From polymorphisme <webmas...@polymorphisme.org>
Subject Performance Analysis (again :)
Date Tue, 23 Aug 2011 09:19:36 GMT


I'm trying the new intermediate format from the article 
"Performance Analysis for Apache FOP's new Intermediate Format"  of Jeremias
and his program
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
      <value name="java.specification.version">1.6</value>      
    <run idx="0">
        <value name="target-format">PDF</value>
        <file mime="application/pdf;mode=painter"

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 =
                        userAgent, mime);

                targetHandler.setResult(new StreamResult(pdffile));

                IFParser parser = new IFParser();

                Source src = new StreamSource(iffile);
                Source xslt = new StreamSource(stampxsltfile);
                TransformerFactory tFactory =
                Transformer transformer = tFactory.newTransformer(xslt);          

                SAXResult res = new
SAXResult(parser.getContentHandler(targetHandler, userAgent));

                transformer.transform(src, res);
            } finally {
            long estimatedTime = System.nanoTime() - startTime;              
            System.out.println("estimatedTime : " + estimatedTime + "\n");
        } catch (Exception e) {

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 ?

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: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

View raw message