lexing algorithm is O(n^2) #3
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: james/lex_luthor#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The lexing algorithm appears to be O(n^2) due to this snippet around line 93:
It appears that this calls String.length() on an input length that grows to the full input source; so, on average, that's half the input source, every time a token is consumed. It appears to take about 18 seconds of CPU time to analyze a 1,000-line source file in the custom DSL I'm implementing.
Oh yeah. That's super dumb. Should be easy enough to fix. Thanks for your report.