xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McCormack <...@mcc.id.au>
Subject Re: Batik feature and performance query
Date Thu, 04 Sep 2008 03:48:14 GMT
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


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.

> 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.

> 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.

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

View raw message