Java Mailing List Archive

http://www.java2.5341.com/

Home » fop-users-digest.xmlgraphics »

fop-users Digest 17 Jan 2013 03:54:37 -0000 Issue 2636

fop-users-digest-help

2013-01-16


Author LoginPost Reply

fop-users Digest 17 Jan 2013 03:54:37 -0000 Issue 2636

Topics (messages 36168 through 36173)

Re: Performance improvement suggestions
 36168 by: Pascal Sancho
 36169 by: Alexios Giotis
 36170 by: nels
 36171 by: nels
 36172 by: Alexios Giotis
 36173 by: nels

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: fop-users@(protected)
To unsubscribe, e-mail: fop-users-digest-unsubscribe@(protected)
For additional commands, e-mail: fop-users-digest-help@(protected)

----------------------------------------------------------------------


Attachment: fop-users_36168.eml (zipped)
Hi,

tables are good for data grids, but you can use alternate solution in
many cases.

Example 1: Border can apply to many FOs, so you don't need to use table here.

Example 2: title starting with graphic symbol:

table solution needs a complete table structure:
fo:table/fo:table-body/fo:table-row, plus 2 table-cell (witch consumes
time and memory)

Alternative: only 2 fo:block-container:
<fo:block-container keep-with-next="always" space-after="-{$my_inner_height}">
<!-- graphic block -->
</fo:block-container>
<fo:block-container start-indent="{$my_width_allocated_to_graphic_symbol}">
<fo:block start-indent="0">My title</fo:block>
</fo:block-container>

Note that such solution need to understand how indent inheritance is
done in XSL-FO (see [1]).

HTH

[1] http://wiki.apache.org/xmlgraphics-fop/IndentInheritance

2013/1/14 nels <nbhchan@(protected)>:
> My first FOP project ... I am trying to provide near instantaneous conversion
> of XML to PDF for our users and have written a custom XSL-FO. Having read a
> number of threads here I have seen the suggestion to replace PNG images with
> JPG. I have done this though from my timings I can't say with certainty that
> run times have reduced. I have seen other suggestions and seek some more
> information as to how to implement them - they are:
>
> load style sheets into memory,
> use a server VM and
> don't use tables.
>
> The third suggestion I could probably do but would take a fair bit of effort
> and I would like to know up front if this would speed things up
> significantly. Also how do I draw the table cell borders if I don't
> explicitly use tables?
>
> Any assistance appreciated.
>
>
>
> -----
> just starting out with FOP - don't hurt me!

--
pascal


Attachment: fop-users_36169.eml (zipped)

On 14 Jan 2013, at 09:25, nels <nbhchan@(protected):

> My first FOP project ... I am trying to provide near instantaneous conversion
> of XML to PDF for our users and have written a custom XSL-FO.

Welcome to FOP.



> Having read a
> number of threads here I have seen the suggestion to replace PNG images with
> JPG. I have done this though from my timings I can't say with certainty that
> run times have reduced. I have seen other suggestions and seek some more
> information as to how to implement them - they are:
>
> load style sheets into memory,

I guess you mean keeping in memory a javax.xml.transform.Templates object for each XSLT and I assume that you are embedding FOP in your application (if not, then it will be much faster). Using Templates is a good practice, easy to implement, so do it but don't expect to see big differences. Also note that this step is not really part of FOP. FOP consumes the XSL:FO which is the output of this transformation.

> use a server VM and
Yes, it will definitely help.


> don't use tables.
I am not aware of any significant performance penalty due to the usage of tables. For big tables, there was https://issues.apache.org/jira/browse/FOP-1888 which is fixed in the latest 1.1 release. If you really need tables for your layouts then use them and come back to it, if you later see that this is slow.

You will have to write at least how many pages your documents are and what you mean by "near instantaneous conversion". Assuming you have images and an output of 2-4 pages, it will be hard to get below 100ms per document, after warming up. Having said that, here is some other points that will help:

* Create a single org.apache.fop.apps.FopFactory and reuse it. It should be thread-safe and this is how you will get the best performance after rendering a couple of documents (warm-up)

* Make sure the JVM has enough heap (-Xmx). I would not recommend below 512MB.

* If you don't need complex script support (e.g. Arabic, Hebrew scripts), then use
userAgent.setComplexScriptFeaturesEnabled(false);

* This is obvious, but use the latest FOP release.

There are some other more advanced tricks one could use. They are harder to implement and don't apply in all cases. For example, about 80% of the time is to convert from XSL:FO to FOP intermediate format and the other 20% is from the intermediate format to the final PDF format. So caching or producing directly the intermediate format is faster. This is of course FOP specific, not well documented and might not be compatible with past & future FOP versions.

I hope you have enough suggestions to get started,

Alexis Giotis






Attachment: fop-users_36170.eml (zipped)
Alexios Giotis wrote
>> use a server VM and
> Yes, it will definitely help.

Where can I find instructions on setting up a server VM?


Alexios Giotis wrote
> You will have to write at least how many pages your documents are and what
> you mean by "near instantaneous conversion". Assuming you have images and
> an output of 2-4 pages, it will be hard to get below 100ms per document,
> after warming up. Having said that, here is some other points that will
> help:
>
> * Create a single org.apache.fop.apps.FopFactory and reuse it. It should
> be thread-safe and this is how you will get the best performance after
> rendering a couple of documents (warm-up)

How do you do that?


Alexios Giotis wrote
> * Make sure the JVM has enough heap (-Xmx). I would not recommend below
> 512MB.
>
> * If you don't need complex script support (e.g. Arabic, Hebrew scripts),
> then use
> userAgent.setComplexScriptFeaturesEnabled(false);
>
> * This is obvious, but use the latest FOP release.

I'll try these. I'm using 1.1 RC1 and JRE 1.6 on AIX 5.3.



-----
just starting out with FOP - don't hurt me!
--
Sent from the FOP - Users mailing list archive at Nabble.com.


Attachment: fop-users_36171.eml (zipped)
Pascal Sancho-2 wrote
> tables are good for data grids, but you can use alternate solution in
> many cases.
>
> Note that such solution need to understand how indent inheritance is
> done in XSL-FO (see [1]).

Thanks Pascal but I would like to try Alexis' suggestions first as this
would seem to require less reworking of my XSL-FO.



-----
just starting out with FOP - don't hurt me!
--
Sent from the FOP - Users mailing list archive at Nabble.com.


Attachment: fop-users_36172.eml (zipped)

On 14 Jan 2013, at 12:43, nels <nbhchan@(protected):

> Alexios Giotis wrote
>>> use a server VM and
>> Yes, it will definitely help.
>
> Where can I find instructions on setting up a server VM?

You will have to check the Java documentation. For Sun/Oracle JVMs, we typically add -server command line option, when we start java. Last time I worked on AIX, there was no java ...

>
>
> Alexios Giotis wrote
>> You will have to write at least how many pages your documents are and what
>> you mean by "near instantaneous conversion". Assuming you have images and
>> an output of 2-4 pages, it will be hard to get below 100ms per document,
>> after warming up. Having said that, here is some other points that will
>> help:
>>
>> * Create a single org.apache.fop.apps.FopFactory and reuse it. It should
>> be thread-safe and this is how you will get the best performance after
>> rendering a couple of documents (warm-up)
>
> How do you do that?

I assume you have some Java programming background. Check
http://xmlgraphics.apache.org/fop/1.1/embedding.html

The example that is closer to what you are doing is:
ExampleXML2PDF (referenced in the above link).

>
>
> Alexios Giotis wrote
>> * Make sure the JVM has enough heap (-Xmx). I would not recommend below
>> 512MB.
>>
>> * If you don't need complex script support (e.g. Arabic, Hebrew scripts),
>> then use
>> userAgent.setComplexScriptFeaturesEnabled(false);
>>
>> * This is obvious, but use the latest FOP release.
>
> I'll try these. I'm using 1.1 RC1 and JRE 1.6 on AIX 5.3.

Update to FOP 1.1 release.

Finally, I have noticed some performance improvements using
fopFactory.setStrictValidation(false);

Alexis Giotis


>
>
>
> -----
> just starting out with FOP - don't hurt me!
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/Performance-improvement-suggestions-tp37754p37757.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@(protected)
> For additional commands, e-mail: fop-users-help@(protected)
>



Attachment: fop-users_36173.eml (zipped)
Alexios Giotis wrote
> Update to FOP 1.1 release.
>
> Finally, I have noticed some performance improvements using
> fopFactory.setStrictValidation(false);
>
> Alexis Giotis

I have updated to 1.1 now.
Adding fopFactory.setStrictValidation(false); directly into the fop script
gives me this error:
fop[263]: 0403-057 Syntax error at line 1 : `(' is not expected.

The actual line added is:
FOP_OPTS="fopFactory.setStrictValidation(false);"

Appreciate your advice.



-----
just starting out with FOP - don't hurt me!
--
Sent from the FOP - Users mailing list archive at Nabble.com.

©2008 java2.5341.com - Jax Systems, LLC, U.S.A.