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

Can be very slow, at least with embedded data #5

Closed
Nanonid opened this issue Sep 5, 2014 · 5 comments
Closed

Can be very slow, at least with embedded data #5

Nanonid opened this issue Sep 5, 2014 · 5 comments

Comments

@Nanonid
Copy link

Nanonid commented Sep 5, 2014

On an XML with embedded data URI and SVG element text, parsing and then subsequent findAllElements takes several seconds and hangs the browser while parsing.
There's only about 3000 XML elements in the file, but with embedded data, is about 2.3 MB.

Same file when using responseXML is about one second.

It's an issue because I can't use the library as is. Trying xml_stream with my own search routines.

@renggli
Copy link
Owner

renggli commented Sep 5, 2014

Thank you for your report. Can you provide a link to an XML file that shows the issue, so that I can reproduce the problem on my machine?

@renggli
Copy link
Owner

renggli commented Sep 6, 2014

I committed some improvements (b40dc44) that significantly speed up the XML parser performance. I also updated the pub package (a9ea5c3).

For further improvements I need to see what exact problem you are observing. If necessary, please reopen this issue and provide a test-case (for example in a pull request of https://github.com/renggli/dart-xml/blob/master/test/xml_benchmark.dart).

@renggli renggli closed this as completed Sep 6, 2014
@Nanonid
Copy link
Author

Nanonid commented Sep 6, 2014

I'm going to try this right now!
Thanks! BoutySource?

@Nanonid
Copy link
Author

Nanonid commented Sep 6, 2014

Can't submit bounties on closed issues. Gah.

@Nanonid
Copy link
Author

Nanonid commented Sep 6, 2014

Parsing KML XSD which can be found here:
http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd
Simplistic:
class Schema {
xml.XmlDocument doc;
Schema( String txt_ ){
parse(txt_);
}

bool parse( String xml_ ){
if( xml_ == null || xml_.isEmpty ){
throw "No XML to parse";
}
doc = xml.parse(xml_);
return true;
}
}
void main() {
File kml = new File('../schema/kml/2.2.0/ogckml22.xsd');
String kmlSchemaTxt = kml.readAsStringSync( encoding:UTF8 );
Stopwatch stopwatch = new Stopwatch()..start();
Schema kmlschema = new Schema( kmlSchemaTxt );
print( "${stopwatch.elapsed}");
}

Output:
0:00:00.143166

Which I'm quite happy with.

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

No branches or pull requests

2 participants