xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lolling, Jan" <Jan.Loll...@t-systems.com>
Subject AW: performance probs with winxp tablet OS pen input
Date Mon, 14 Apr 2003 13:17:03 GMT
It is not a god idea to manipulate the DOM at every single mouse event.
This methode is very slow and not applicable, I agree to you but this behavior is not a bug
!
I build a editor for SVG and all changes and mouse moves will be cached in memory in my own
simple structure and at the end I update the element in DOM.

For this action I build a handle for every element type and that handle get notice from mouse
moves and all other input events and at a defined end (e.g. right mouse button) I commit the
changes to the element in DOM.

Helper lines will be painted in the overlay structure.

Jan

-----Ursprungliche Nachricht-----
Von: Mitch Germansky [mailto:mbg@cs.rutgers.edu]
Gesendet: Montag, 14. April 2003 14:57
An: batik-users@xml.apache.org
Betreff: 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

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


Mime
View raw message