Some performance tweaks#22
Closed
kmh287 wants to merge 2 commits into
Closed
Conversation
GerHobbelt
reviewed
Mar 26, 2017
|
|
||
| lines = match[0].match(/(?:\r\n?|\n).*/g); | ||
| // Bail from match if string doesn't contain newline nor carriage return | ||
| if (lines.indexOf('\n') != -1 || lines.indexOf('\r') != -1) { |
Contributor
There was a problem hiding this comment.
nitpick: lines isn't initialized here yet. indexOf() should be applied against match[0] instead.
Author
There was a problem hiding this comment.
Ah yes, you're right. Thank you!
GerHobbelt
added a commit
to GerHobbelt/jison-lex
that referenced
this pull request
Mar 26, 2017
…rformance' # Conflicts: # regexp-lexer.js
GerHobbelt
added a commit
to GerHobbelt/jison-lex
that referenced
this pull request
Mar 26, 2017
…thout it for the test grammars ATM; to be revisited later on when zaach#20 is addressed...
Contributor
|
related to #17 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm working on a project where I'm considering using Jison as a parser generator. I've found the following tweaks to the generated parser has given a modest performance improvement. I would like to submit these changes back to you if you want them.
The changes include
The modified parser passes all the tests on my side, however you're far familiar with the code than I am so please let me know if you have any feedback on these changes.