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 Mitch Germansky <mb...@cs.rutgers.edu> on 2003/04/14 14:57:10 UTC

performance probs with winxp tablet OS pen input

abstract:
--------
slow performance with tablet pen input; mouse is fine;
seems to be independent of cpu speed or RAM.

i am eager to get suggestions on how to improve the performance here.
any feedback from others playing with pen input on tablets is
appreciated.  as i am new to the batik world, please let me know if i
should be opening a bug report.

details:
-------
i am experiencing performance issues when capturing pen input and
updating the display of a dynamic SVG document on a tablet pc (winxp
tablet OS).  same results with 1.5 beta 4 and 5.  my app runs under java
web start (jws 1.2) and is built with j2sdk1.4.0.

the perf problem is seen in the part of the app that captures pen (or
mouse) strokes, draws them on the display by appending line children
elements to the dynamic SVG doc.  the lines drawn to the display with
the pen will lag behind true pen strokes; however lines always update in
sync with physical mouse movements.

interesting that on the same tablet mouse input performs fine!

javaw.exe cpu consumption with lots of input from:
   mouse: 86-93%
   pen:   90-96%

total cpu is near 100% with both the mouse and the pen with remaining
cpu cycles mostly consumed in the windows taskmgr.exe

i've tested this app with similar performance problems on several
different tablet pc with intel PIIIm from 800MHz to 1.3GHz; also have
tried RAM from 256MB to 768MB.

the code is rather straight forward IMHO.  pertinent portions are
included below.


TIA.
-mitch

- - - - - - - -

   public void mouseMoved(org.w3c.dom.events.Event event) {
     if (! recording) return;  // nothing to draw on yet
     if (! mouseIsDown) return;

     org.w3c.dom.events.MouseEvent e
       = (org.w3c.dom.events.MouseEvent) event;

     //    System.out.println("mouseMoved");
     final int startX = lastX;
     final int startY = lastY;
     final int endX = e.getClientX();
     final int endY = e.getClientY();

     try {
       // now draw the SVG line
       drawSVGLine(document,
                   startX, startY, endX, endY);
     } catch (Exception e2) {
       e2.printStackTrace(System.err);
     }

     lastX = endX;
     lastY = endY;
   }

   private void drawSVGLine(SVGDocument doc,
                            int fromX, int fromY,
                            int toX, int toY) {
     Element line = doc.createElementNS(SVGUtils.svgNS, "line");
     line.setAttribute("x1", "" + fromX);
     line.setAttribute("y1", "" + fromY);
     line.setAttribute("x2", "" + toX);
     line.setAttribute("y2", "" + toY);

     line.setAttributeNS(SVGUtils.svgNS, "id",
      SVGUtils.scribbleLineIdPrefix + scribbleLineCount++);
     line.appendChild(getAnimationElement(doc, "visible"));

     // attach the line to the scribble group
     scribbleGroup.appendChild(line);
   }

   // from SVGUtils
   public static final String svgNS
     = SVGDOMImplementation.SVG_NAMESPACE_URI;

   public static final String scribbleLineIdPrefix
     = "scribble_line_";



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