-
Notifications
You must be signed in to change notification settings - Fork 607
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
0.1 to 0.4 upgrade big slowdown #157
Comments
Are you using the 0.1 settings or 0.2 settings in xml2js? |
I don't set any options/settings, so I am guessing it's the 0.1 settings since I am using 0.1.14. (?) After using multiple measurements, I have to correct myself and say that 0.4.4 is 'only' about twice as slow as 0.1.14 in the above issue. |
Then please try with the 0.1 settings in 0.4, see the README and let me know how the numbers look like. |
Ok. I'll get back to you. |
These timings are fluctuating +/- 200ms. |
Hmm, yes, for now I'd recommend a faster XML parser. Maybe once I get to finish the htmlparser2 port it will get faster, but that one is not a big priority right now, sorry. |
Do you know any other parsers? For now I put One would think that a node module using a binary component could outperform pure javascript modules but the availability is meager at best. So I am hoping I'm missing something. There's a lot of XML out there. |
You could try For me one of the priorities had been to go without native compilation, but if you need the speed, xml2js is admittedly not the best choice. |
Thank you. I will add this to my tests. And as general words of praise, especially for smaller XML files, xml2js has always been friendly to me. Just curious, since expat has SAX bindings, could node-expat be a relatively hassle-free drop-in replacement to sax-js in xml2js? An option or switch in source to use a compiled parser might make some people happy; those working with XML files that started young and light but have grown old and ugly. ;) |
It might be possible, I haven't given this any thought. You sure the node-expat binding exports the SAX API? |
Actually I am not sure. There is no wiki and I cannot find any documentation. But the title of the repo is:
And since SAX implies API (Simple Api for Xml) I blatantly assumed it did. :P |
If anyone is still interested, EasySax seems to be a damn fast parser, written in JS.
I feel there has to be a catch somewhere but I don't see it yet, other than the weird characters in the documentation. |
Seems to be streaming. Doesn't convert to object itself. |
Yeah, this is regarding to the discussion about the sax-js "backend" of xml2js and replacing it with node-expat. |
How does easysax (or any of these other libs) work with browserify? |
@csimi Does your version with the easysax backend pass the unit tests? I am in no means married to sax-js, I just want to avoid a dependency that has to be compiled. On the other hand, if you saturate your network connection, serializing XML into an object is probably going to be inherently expensive, if you have high performance in mind a streaming solution like raw SAX or similar might indeed be preferable. |
@Leonidas-from-XIV, if you replace the parser with one that does not work 100% with browserify, then I will be forced to fork it. Can we introduce an external hook rather than outright replacing it? Side effects could be huge - If one of these replacement libs is actually async, unlike sax-js (because of eventemitter), then a lot of people will come screaming. |
@tflanagan I understand your issue and will try to take it into account. Your complaint is actually why I would be agains supporting multiple backends, because then the semantics of the library might change in unforeseen ways and some people will be surprised trying to have the same behaviour everywhere might end up an uphill battle for little benefit. I'd rather have one solid backend that works for everybody. |
@Redsandro Russian intro on easysax page actually says it's not streaming |
@csimi can you publish your xml2js + easysax repo? |
My run on a 46kB XML file:
|
@Redsandro It doesn't seem to compile with Node.js 5.8.0? Does it support Node.js 4.x and 5.x? |
@kyrylkov oops no idea actually. I'm running legacy (pre io.js-post-fork-merge) node.js for production reasons. |
@kyrylkov Compiles on 4.x according to dev:
|
I'll try to put something usable together during the weekend. xml2js x 2.33 ops/sec ±27.49% (10 runs sampled) The easysax bench doesn't actually build a js object, just runs a SAX pass over my 215KiB XML test file (fastest mode, without parsing attributes, etc). Rapidx2j is pretty fast but just how much time it takes to actually build a JS object is clearly visible. I feel like EasySax is too fast (compared to expat for example) to be standards compliant. There has to be a catch somewhere. |
How do you mean? I need to create that JS object anyhow, so I prefer the module takes care of that. In the case of Is there a (simple) way to use So far, rapidx2j seems the fastest but I cannot use it without forking, as the current module implements a custom lossy standard, changing caps and such. |
Hi people,
I have been using
node-xml2js
v0.1.14
'sxml2json.Parser().parseString
without further options onXML
files which kept getting bigger. Now these files up to ~2MB take nearly a second to translate tojs
.So I thought, let's update and see if there are speed improvements. However, after I updated
node-xml2js
to v0.4.4
, I noticed that in stead of a speed increase, I get a big slowdown were it now takes 8 to 10 seconds.Are there some special options necessary in the 0.4 version? Or is this module just not meant for bigger XML? Something else I'm missing?
For now I'm downgrading to the much faster version 0.1, and I'll continue my search for fast converters.
The text was updated successfully, but these errors were encountered: