xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Thorn <da...@fysh.org>
Subject Object reuse, and speeds
Date Thu, 08 Nov 2012 09:23:21 GMT
Hi,

I've seen in the documentation about reusing objects:

> Fop instances shouldn't (and can't) be reused. Please recreate
> Fop and FOUserAgent instances for each rendering run using the
> FopFactory. This is a cheap operation as all reusable information
> is held in the FopFactory. That's why it's so important to reuse
> the FopFactory instance.

But it seems that creating a newFop is a more expensive operation
than I was expecting:

FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);

The 'newFop' call takes 600-700ms on my (not underpowered)
desktop.  I first started timing this after I'd made fonts
"work", so I've noticed that if I remove the font config from my
fop config file[1], or just empty my fonts directory, then newFop
takes 100-150ms.

I have only 8 font files in my fonts directory (arial and arial
narrow, bold/italic/underline versions).  The font cache is being
created, so I presume it is also being used.

Is there any way to improve this speed?  A lot of the
documentation on the web seems to relate to earlier versions and
I've seen it mentioned that the way I'm doing it is correct for
1.0 (I intend to move to 1.1 once it's in the central maven
repositories).

A 500ms delay might not seem like a lot, but I'm trying to
replace an existing application, so I have a metric the newapp
will be judged by, and 500ms before we even begin the transform
(currently ~1500ms on an incomplete document) seems to be
starting on the back foot.


Thanks,


[1] <renderers>
    <renderer mime="application/pdf">
      <fonts>

	<directory recursive="true">/home/davet/fop/1/fonts</directory>

      </fonts>
    </renderer>
  </renderers>

-- 
dave thorn

DBT; GBP.

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message