Skip to content

endDocument is called even after pause/resume used - #28

Merged
robrighter merged 2 commits into
robrighter:masterfrom
alexlatchford:master
Sep 11, 2012
Merged

robrighter merged 2 commits into
robrighter:masterfrom
alexlatchford:master

Conversation

@alexlatchford

Copy link
Copy Markdown

With the current code after an interrupt is sent, i.e. a pause() is called the interrupt flag is never reset to false at any point so endDocument can never be called. I'm sure this could be improved further but it works for the scenario I need it to work so enjoy :)

Alex Latchford added 2 commits September 10, 2012 11:18
…lly only make it search the length of the needle at the start of the haystack instead of the rest of it.
@alexlatchford

Copy link
Copy Markdown
Author

This now also includes a major speed boost to the parser. It essentially rewrites the indexOf function so make it into something similar to a startswith function only you have to specify the start too..

The problem with the old _parse function was that as the length of the haystack, (i.e. the XML document to parse), increased and the needle wasn't found then it kept looking all the way until the end of the string which was very inefficient..

By adding this function I've sped up my program by a thousand times I'd estimate, I am reading in a 20mb file non-chunked correctly but in the near future the same parser will need to deal with upwards of 160mb so you may some more improvements. Currently it can parse that and put it into a mongodb in just under an hour we're estimating which is good enough for this project but it wouldn't be possible without this second improvement :)

robrighter added a commit that referenced this pull request Sep 11, 2012
endDocument is called even after pause/resume used
@robrighter
robrighter merged commit 3038a07 into robrighter:master Sep 11, 2012
@robrighter

Copy link
Copy Markdown
Owner

Thanks, I will get this pushed out into npm in the next day or so..... sorry for the delay.

Thanks again!
rob

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

Successfully merging this pull request may close these issues.

2 participants