miraclebg / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

Reuse XML ActiveX object on Internet Explorer #421

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
From Li Yang at IBM:

Hi Brad,

This is Li Yang from IBM China Development Lab.  I've been working for
Christopher C. Mitchell for the last couple of month, focusing on the
dojo+svgweb configuration, trying to make it work, in terms of performance
and functions.

I'm writing to you because I found a small tweak in svgweb that could speed
up a test case about 25%, which might be interesting to you.  The test case
is a drawing of a tiger's head (got from dojo perf test suite), it first
creates a dynamic svg root and then add lots of path nodes to the scene. 
Below is the profiler result provided by IE8 dev tool, running with the
latest source code from SVN.

As highlighted, in the parseXML() function, ActiveXObject code is involved
everytime a path node is created, and sum up it takes about 1.8 sec,
approximately 1/4 of the total page load time.  After several attempts, I
discovered that by cache and clone met XML, the repeated creation of
ActiveXObject could be eliminated.  A shabby fix would like: (see also the
attached patch file)

var parseXMLCache = {};

function parseXML(xml, preserveWhiteSpace) {

  var cached = parseXMLCache[preserveWhiteSpace + xml];
  if (cached) {
          return cached.cloneNode(true);
  }

 // original parseXML() impl, parse and create xml document object
  // ....

  parseXMLCache[preserveWhiteSpace + xml] = xmlDoc.cloneNode(true);
  return xmlDoc;
}

With the patch, tested it again, and the 1.8 sec ActiveXObject time went
away.  As I have very little idea about svgweb indeed, I believe you are
the best person who will know what to do next.  Maybe this is just a very
specific case, or maybe it's a general beneficial...

Besides, I'm also responsible for running all dojo functional test cases on
svgweb and do whatever I can to make them pass.  Currently still quite some
cases are blocked by svgweb defects, issue No. 296/158/65/169 respectively.
 I've already stared the issues to get notifications, but, if there's
anything I could do to speed up their fix, please let me know.  I'll be
very glad to contribute what I can.  :-) 

Original issue reported on code.google.com by bradneub...@gmail.com on 19 Nov 2009 at 9:55

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by bradneub...@gmail.com on 19 Nov 2009 at 9:55

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1023.

Original comment by bradneub...@gmail.com on 1 Dec 2009 at 7:21

GoogleCodeExporter commented 9 years ago
The fix in r1023 seems not complete. Parsed nodes are never stored into 
'parseXMLCache'.

Original comment by young4ch...@gmail.com on 1 Dec 2009 at 7:55

GoogleCodeExporter commented 9 years ago
I missed part of the patch; reopening.

Original comment by bradneub...@gmail.com on 1 Dec 2009 at 5:16

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1026.

Original comment by bradneub...@gmail.com on 2 Dec 2009 at 2:48