You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Marc Chung <mc...@fastq.com> on 2004/02/04 04:12:19 UTC
Batik performance questions
Performance questions
Hi,
I'm using Batik to generate charts and graphs dynamically within a servlet
container. (Various data graphs, SVG size: ~4-5kb)
Currently I do this by creating an SVG, and then modifying the elements and
attributes to describe my graph. Then, depending on the type of report
requested (HTML or PDF), I either transcode the SVG into a PNG or I use the
PrintTranscoder.print(Graphics, PageFormat, int) to embed the image into my PDF
(Using the iText PDF libraries).
I enjoy the power of the library, but my only real problem is that it's slow.
(1 second per image, 14 images / page. The PrintTranscoder takes noticeably
longer.)
Is this speed normal?
Are there ways to enhance the speed? I would really like to increase performance.
Is this an appropriate use of the PrintTranscoder class?
Is there another way of writing an SVG to a Graphics object?
Should I be cautious about the usage of the PrintTranscoder in a multithreaded
environment?
Thanks for any input,
Marc
-------------------------------------------------
FastQ Communications
Providing Innovative Internet Solutions Since 1993
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Batik performance questions
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Marc,
Marc Chung wrote:
> Performance questions
> I'm using Batik to generate charts and graphs dynamically within a servlet
> container. (Various data graphs, SVG size: ~4-5kb)
>
> Currently I do this by creating an SVG, and then modifying the elements and
> attributes to describe my graph. Then, depending on the type of report
> requested (HTML or PDF), I either transcode the SVG into a PNG or I use the
> PrintTranscoder.print(Graphics, PageFormat, int) to embed the image into my PDF
> (Using the iText PDF libraries).
Do you use the Batik DOM to do this manipulation of the Document?
If you don't then the whole document is "copied" into a Batik DOM
Implementation (so we have CSS and other things required by SVG).
This isn't usually a huge time suck but it is generally an unneeded
one.
> I enjoy the power of the library, but my only real problem is that it's slow.
> (1 second per image, 14 images / page. The PrintTranscoder takes noticeably
> longer.)
What platform (OS/CPU roughly) are you running on?
> Is this speed normal?
1 second per image seems slow to me. Can you post sample content?
Is the 1sec for PNG output or PDF? How large a PNG (pixels) are we
talking abount?
> Are there ways to enhance the speed?
As you might guess there is no magic -go-really-fast switch.
One is that PNG output is much slower than JPEG - I know that
JPEG is not ideal for graphs but it may be something to consider.
> I would really like to increase performance.
> Is this an appropriate use of the PrintTranscoder class?
Well it seems a little hokey to me, I would write a new
transcoder subclass for the iText library. If you look at
the existing transcoder examples it should give you a good
idea of how to do it.
> Is there another way of writing an SVG to a Graphics object?
Sure, all the image transcoders also "write an SVG to a Graphics
object". You might also want to look at the pdf-transcoder that is
built into Batik (using code from FOP).
> Should I be cautious about the usage of the PrintTranscoder in a multithreaded
> environment?
You should be alright as long as you don't try and use the same
document/Graphics across threads. But I don't know anything about
the iText library so perhaps it has problems internally.
>
> Thanks for any input,
>
> Marc
>
>
>
> -------------------------------------------------
> FastQ Communications
> Providing Innovative Internet Solutions Since 1993
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org