Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dismal performance against node with 500 children #14

Open
GoogleCodeExporter opened this issue Mar 19, 2015 · 2 comments
Open

Dismal performance against node with 500 children #14

GoogleCodeExporter opened this issue Mar 19, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

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.

Original issue reported on code.google.com by colind...@gmail.com on 17 Jun 2010 at 4:10

Attachments:

@GoogleCodeExporter
Copy link
Author

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

Original comment by doek...@gmail.com on 17 Jun 2010 at 8:44

  • Added labels: Performance

@GoogleCodeExporter
Copy link
Author

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.

Original comment by colind...@gmail.com on 17 Jun 2010 at 9:16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant