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

speed up lexer parsing #88

Merged
merged 2 commits into from
May 5, 2024
Merged

speed up lexer parsing #88

merged 2 commits into from
May 5, 2024

Conversation

erikyo
Copy link
Collaborator

@erikyo erikyo commented May 5, 2024

During the lexer parsing there are 2 cases that didn't require a regex (that is heavily costly compared to a chr/string comparison).

This small change provides an speed increased of about 20-25%.

Tested with benny

Running "Example" suite...
Progress: 100%

  gettextParser:
    6 631 ops/s, ±0.63%   | slowest, 23.54% slower

  gettextParserNext:
    8 673 ops/s, ±0.42%   | fastest

Finished 2 cases!
  Fastest: gettextParserNext
  Slowest: gettextParser

@erikyo erikyo mentioned this pull request May 5, 2024
10 tasks
@erikyo
Copy link
Collaborator Author

erikyo commented May 5, 2024

I know it may sound like a breaking change but it is not, the regex in the end says exactly what a character comparison is (but much more costly). Additionally this task is performed for each translation block and the benefit is really high

image

@erikyo erikyo merged commit 2f94ed7 into smhg:development May 5, 2024
4 checks passed
@erikyo erikyo deleted the perf-lexer branch May 5, 2024 18:59
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.

1 participant