My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 14: Dismal performance against node with 500 children
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by colind...@gmail.com, Jun 17, 2010
I benchmarked xml2json-xslt against a select node with 500 child option nodes.

time xsltproc --profile xml2json.xsl testselect.xml

real	0m18.185s
user	0m18.100s
sys	0m0.000s

Ouch.

I searched around a bit and found a version which Martynas Jusevičius modified to add attribute and array support.

time xsltproc --profile xml2json-martynas.xsl testselect.xml

real	0m0.046s
user	0m0.040s
sys	0m0.010s

Perhaps his changes could be integrated to greatly improve the performance of xml2json-xslt? The output is different (the array is at object.select.option instead of object.select, actually arguably more sensible), but for how I'm using it, modifying my Javascript to accommodate this is trivial.

Benchmark conducted on HP Compaq nc6400 with Intel(R) Core(TM)2 CPU T7200  @ 2.00GHz and 4GB RAM running Ubuntu 10.04 64-bit.
testselect.xml
9.7 KB   View   Download
xml2json.xsl
7.0 KB   View   Download
xml2json-martynas.xsl
8.8 KB   View   Download
Jun 17, 2010
Project Member #1 doek...@gmail.com
Probably a problem of xsltproc. On Windows 2000 with msxsl.exe it's fractions of a second:

  @echo off
  cls
  echo Start 
  echo. | time
  msxsl.exe testselect.xml xml2json.xsl -o own.json.txt
  echo Stop
  echo. | time
  echo --------------------------------------------
  echo Start 
  echo. | time
  msxsl.exe testselect.xml xml2json-martynas.xsl -o xml2json-martynas.json.txt
  echo Stop
  echo. | time

Output:

  Start
  The current time is: 22:38:23,54
  Enter the new time:
  Stop
  The current time is: 22:38:23,82
  Enter the new time:
  --------------------------------------------
  Start
  The current time is: 22:38:23,84
  Enter the new time:
  Stop
  The current time is: 22:38:23,91
  Enter the new time:

About the different output: we probably don't want to have breaking changes, but I'll leave it open for now.

Benchmarked using a Athlon(tm) XP 1800+ and 256MB RAM running Windows 2000 SP4
Labels: Performance
Jun 17, 2010
#2 colind...@gmail.com
Interesting. Thanks for looking into it. I tested a little more, this time using PHP. It looks like it's a problem in libxml and/or libxslt.

[colin@vwing debug]$ php5 -a
Interactive shell

php > $xml = new DOMDocument();
php > $xml->load("testselect.xml");
php > $xslt = new XSLTProcessor();
php > $xsl = new DOMDocument();
php > $xsl->load("xml2json.xsl", LIBXML_NOCDATA);
php > $xslt->importStylesheet($xsl);
php > print $xslt->transformToXML($xml);
<output snipped>
php > $xsl = new DOMDocument();
php > $xsl->load("xml2json-martynas.xsl",LIBXML_NOCDATA);
php > $xslt->importStylesheet($xsl);
php > print $xslt->transformToXML($xml);
<output snipped>

I just wall-clocked it this time, and the time was approximately the same.
Sign in to add a comment

Powered by Google Project Hosting