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 Dan F <Da...@ec.gc.ca> on 2008/01/18 13:44:06 UTC

FO vs XML/XSLT - is one faster than the other?

I'm just wondering if I could squeeze more performance out of my PDF
generation buy using XML/XSLT?

Right now, I create an FO file using server side code and feed that to the
FOP engine.
-- 
View this message in context: http://www.nabble.com/FO-vs-XML-XSLT---is-one-faster-than-the-other--tp14949362p14949362.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


Re: FO vs XML/XSLT - is one faster than the other?

Posted by Dan F <Da...@ec.gc.ca>.
Thanks Andreas,

Actually, everything is done in memory. I have a function that builds the FO
and sends this to the FOP processor as a stream. No FO file is stored on
disk.

I was logging FO and PDF creation and here's a bit of stats that I picked
up:

- 40% of the time, FO is slower than PDF creation
- And when FO generation is slower, it's 75% longer than PDF creation.
- A high percentages of those 40% are when I include a graphic to be
included to the PDF (.jpg)
- The .jpg is 177KB, 543x419 @ 96dpi

My setup is a Coldfusion MX 6 on Windows. FOP classes are registered within
the Coldfusion server. I would assume latest patches and service pack. The
FOP classes are called within server side code (Coldfusion).

Thanks,

Dan


Andreas L Delmelle wrote:
> 
> 
> On Jan 18, 2008, at 19:53, Dan F wrote:
> 
> Hi Dan,
> 
>>
>> At this point, I don't think I can trim my FO any further.  
>> Initially, I had a
>> lot of embedded tables for layout which I've all changed to positioned
>> blocks. The rendering time went down considerably. I'm up to about  
>> 9-10
>> pages per second when generating PDFs. From what I read, this is  
>> quite poor.
> 
> Can you give more context on the setup?
> The biggest disadvantage where it comes to performance in your  
> approach (if that is what I think it is) is that the FO file is  
> ultimately stored on disk somewhere (unless you create and treat it  
> as a String or a Stream). So it generates more disk I/O, as the FO  
> first needs to be written then read back in.
> 
> If you would switch to using XML + XSLT, the FO document as such  
> would only exist in memory, as the SAX Events that result from the  
> XSLT transform. Less external I/O normally means more speed. As  
> Jeremias hinted, though, you would have to take care that the XSLT  
> code is written using best practices, or it may turn out to make  
> matters worse.
> 
> 
> Cheers
> 
> Andreas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/FO-vs-XML-XSLT---is-one-faster-than-the-other--tp14949362p14995996.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


Re: FO vs XML/XSLT - is one faster than the other?

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Jan 18, 2008, at 19:53, Dan F wrote:

Hi Dan,

>
> At this point, I don't think I can trim my FO any further.  
> Initially, I had a
> lot of embedded tables for layout which I've all changed to positioned
> blocks. The rendering time went down considerably. I'm up to about  
> 9-10
> pages per second when generating PDFs. From what I read, this is  
> quite poor.

Can you give more context on the setup?
The biggest disadvantage where it comes to performance in your  
approach (if that is what I think it is) is that the FO file is  
ultimately stored on disk somewhere (unless you create and treat it  
as a String or a Stream). So it generates more disk I/O, as the FO  
first needs to be written then read back in.

If you would switch to using XML + XSLT, the FO document as such  
would only exist in memory, as the SAX Events that result from the  
XSLT transform. Less external I/O normally means more speed. As  
Jeremias hinted, though, you would have to take care that the XSLT  
code is written using best practices, or it may turn out to make  
matters worse.


Cheers

Andreas

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


Re: FO vs XML/XSLT - is one faster than the other?

Posted by Dan F <Da...@ec.gc.ca>.
At this point, I don't think I can trim my FO any further. Initially, I had a
lot of embedded tables for layout which I've all changed to positioned
blocks. The rendering time went down considerably. I'm up to about 9-10
pages per second when generating PDFs. From what I read, this is quite poor.


Jeremias Maerki-2 wrote:
> 
> It can be faster if your FO generation code is very slow. :-) Seriously,
> there's no hard rule that says one or the other is faster. XSLT can be
> slow if done wrong but you can't say that using XML/XSLT is
> automatically slower than any other approach. Generating FO directly
> (i.e. hard-wired into an application) is considered bad practice as it
> usually lacks flexibility and maintainability. XSL-FO is usually meant
> to be used with XSLT, after all you can already see from the names that
> they are coming from the same place. XSL-FO + XSLT = XSL. Some people
> use Velocity or even JSP to generate FO.
> 
> It's probably better to analyze the FO you generate to find out if you
> can trim it a little. The more efficient the FO the faster it can be
> processed, i.e. it can also have an influence on how fast FOP can
> process it.
> 
> On 18.01.2008 13:44:06 Dan F wrote:
>> 
>> I'm just wondering if I could squeeze more performance out of my PDF
>> generation buy using XML/XSLT?
>> 
>> Right now, I create an FO file using server side code and feed that to
>> the
>> FOP engine.
>> -- 
>> View this message in context:
>> http://www.nabble.com/FO-vs-XML-XSLT---is-one-faster-than-the-other--tp14949362p14949362.html
>> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/FO-vs-XML-XSLT---is-one-faster-than-the-other--tp14949362p14956080.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


Re: FO vs XML/XSLT - is one faster than the other?

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
It can be faster if your FO generation code is very slow. :-) Seriously,
there's no hard rule that says one or the other is faster. XSLT can be
slow if done wrong but you can't say that using XML/XSLT is
automatically slower than any other approach. Generating FO directly
(i.e. hard-wired into an application) is considered bad practice as it
usually lacks flexibility and maintainability. XSL-FO is usually meant
to be used with XSLT, after all you can already see from the names that
they are coming from the same place. XSL-FO + XSLT = XSL. Some people
use Velocity or even JSP to generate FO.

It's probably better to analyze the FO you generate to find out if you
can trim it a little. The more efficient the FO the faster it can be
processed, i.e. it can also have an influence on how fast FOP can
process it.

On 18.01.2008 13:44:06 Dan F wrote:
> 
> I'm just wondering if I could squeeze more performance out of my PDF
> generation buy using XML/XSLT?
> 
> Right now, I create an FO file using server side code and feed that to the
> FOP engine.
> -- 
> View this message in context: http://www.nabble.com/FO-vs-XML-XSLT---is-one-faster-than-the-other--tp14949362p14949362.html
> Sent from the FOP - Users mailing list archive at Nabble.com.



Jeremias Maerki


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