xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Peterson <stevep...@zpfe.com>
Subject Re: Batik feature and performance query
Date Thu, 04 Sep 2008 19:21:07 GMT
At 10:48 PM 9/3/2008, Cameron McCormack wrote:
>Hello Steve.
>
>Steve Peterson:
> > I'm sure I'll have more questions, but the ones I have now are:
> >
> > 1.  I'd like to be able to wrap Batik in a simple web service that
> > accepts as input a SVG document, and returns a JPEG -- kind of like the
> > SVG Rasterizer but http focused.  Is there a common way of doing this?
>
>Yes, if you run a Java servlet container (like Jetty or Tomcat) you can
>rasterise upon fetching of an HTTP URL.  I wrote a short servlet
>example:
>
>   http://mcc.id.au/2007/09/batik-course/code/transcoding-servlet/
>
>The actual Java source under that directory
>(WEB-INF/classes/TranscodingServlet.java) shows how you can grab three
>request parameters (that would come via the query string in a GET, or
>from the form post body with a POST), do some rasterisation based on
>that, then spit out the raster back to the browser.

Thanks for the pointer -- just the sort of thing I was looking for.


> > 2.  I stripped the sydney.svg sample document of the interactive
> > features and filter effects, and find that I can render it about once a
> > second using the SVG Rasterizer (rendering 10 copies and averaging) on my
> > notebook (Core Duo T7500 and JDK 1.6).  Is this typical performance?
>
>Are you invoking the JVM each time here?  If so, then yes that would be
>typical performance, because JVM startup would take up nearly all of
>that time.  You need to have the JVM still running and the classes
>loaded to get the best performance.  This is what you will get if you
>use the servlet (or some equivalent) approach.

I'm invoking the rasterizer once with 10 copies 
of the .svg file on one command line:

C:\work\libraries\batik-1.7\sp-test>java -jar 
..\batik-rasterizer.jar a.svg b.svg c.svg d.svg 
e.svg f.svg g.svg h.svg i.svg j.svg
About to transcode 10 SVG file(s)

Converting a.svg to a.png ... ... success
Converting b.svg to b.png ... ... success
Converting c.svg to c.png ... ... success
Converting d.svg to d.png ... ... success
Converting e.svg to e.png ... ... success
Converting f.svg to f.png ... ... success
Converting g.svg to g.png ... ... success
Converting h.svg to h.png ... ... success
Converting i.svg to i.png ... ... success
Converting j.svg to j.png ... ... success

Here's what the CPU utilization looks like during that run:

[]



> > 3.  What's the best way to get good performance out of Batik?  Does it
> > make good use of multicore machines?  Are there opportunities to
> > leverage video card support to improve performance?
>
>Batik doesn’t do anything specific to support multicore or hardware
>graphics.  Assuming the JVM you’re running on does it correctly, using
>multiple Java threads should help you if you are performing multiple
>rasterisations simultaneously.  (And that’s what should happen when
>using a servlet  each HTTP request should spawn a new thread.)  As for
>the video card, as far as I know that Java2D classes from Sun don’t use
>hardware acceleration.

It doesn't look to me like Java2d acceleration 
makes any difference in Batik's performance.


>--
>Cameron McCormack ≝ http://mcc.id.au/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org

Mime
View raw message