You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Lance Goforth <la...@arn.net> on 2008/01/21 19:14:55 UTC

Speed and Memory Issues

I'm using the AWT renderer to preview the fop translation in my
application.  It works well for smaller translations, but if it gets too
big it takes too long and too much memory.  I know that the renderer is
doing all pages prior to displaying any pages which is why it is taking
so long.

Are their any suggestions or alternatives on ways to be able to still
view the translation before printing and not have the
render/memory/speed issue of all rendering all pages up front?

Lance Goforth

Re: Speed and Memory Issues

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 21.01.2008 19:14:55 Lance Goforth wrote:
> I'm using the AWT renderer to preview the fop translation in my
> application.  It works well for smaller translations, but if it gets too
> big it takes too long and too much memory.  I know that the renderer is
> doing all pages prior to displaying any pages which is why it is taking
> so long.

Not exactly. Layout is performed for all pages, yes, but the rendering
is really just happening after layout is done. Normally, this process is
interleaved for renderers which produce a file, but for the AWT renderer
all pages are collected and then viewed (at least that's what I see).

> Are their any suggestions or alternatives on ways to be able to still
> view the translation before printing and not have the
> render/memory/speed issue of all rendering all pages up front?

The AWT renderer itself hasn't received much attention in the past and
the code flow is a little complicated. I'm pretty sure that it could be
improved if someone invested a little time to track down possible points
for improvement. Shot from the hip, I don't have any fast track
solutions for you.

I've got a few ideas but I don't want to go down into all the details
because that takes too much time, but maybe you get a good idea out of
it:
- You could experiment with the intermediate format (area tree XML). You
could render to that format in one thread and somehow feed the necessary
pages back into the preview. But that would require some rewiring of the
preview.
- There's a clone() call in AWTRenderer.renderPage(). I'm not sure if
this is necessary. You could test if everything works without cloning
all the pages.
- There's a CachedRenderPagesModel which writes the pages to a file
instead of keeping them in memory. This class is currently not wired
into FOP's code but it should still work. It could help lower the amount
of object held in memory after layout is complete.
- It should be possible to display the first page in the viewer after it
has been sent to the AWT Renderer. I don't know why this doesn't happen
today. Clicking around in the renderer while layout is still running
seems to trigger the displaying of a page but the contents come out
garbled which could be a side-effect of AWT being single-threaded. Only
after the layout is done are the pages displayed correctly. You could
try to investigate if there's a fix for that.

HTH

Jeremias Maerki


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