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

Removing Some Clones in the Lexer #268

Open
wants to merge 10 commits into
base: stage
Choose a base branch
from

Conversation

ec2
Copy link
Contributor

@ec2 ec2 commented Apr 3, 2023

Howdy! I was chatting with my good friend @jimjbrettj and was inspired to take a look at compilers and specifically the Huff compiler because it was so simple. So I thought I'd make some baby contributions.

The main contribution here is isolated to the Lexer. The primary contribution here was to remove some clones that happen super frequently. There is a downside to this as now we're matching on manually typed strings as opposed on matching on an enum. Feel free to close this PR if matching on strings isn't cool with y'all!

Noteable: Lexer is 50% faster in benchmarks. Benchmarks ran on MacOS Monterey (2.3 GHz Quad-Core Intel Core i7 with 32GB RAM)
Here is the performance difference:
Before:
Screen Shot 2023-04-03 at 3 15 55 PM
After:
Screen Shot 2023-04-03 at 3 17 48 PM

@Maddiaa0 Maddiaa0 requested a review from clabby April 4, 2023 20:32
@Maddiaa0 Maddiaa0 added the lexer Huff Lexer Changes. label Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lexer Huff Lexer Changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants