Hi Dave,

The problem here is several fold, firstly the "old" (and by that I mean what was used in versions <= 1.1) had to configure the fonts in the fop conf on each run (thus the need for a fonts-cache). However, we have put some time into improving the performance of these mechanisms in trunk. I'd say, try trunk and let me know if that helps; what you should find is that the first creation of the Fop object is as costly as it was before, but subsequent instantiations of the object shouldn't have as much of a performance impact.

Let me know if that does what you're looking for,

Hope that helps,


On 8 November 2012 09:23, Dave Thorn <davet@fysh.org> wrote:

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

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.


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

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


dave thorn


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