Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lexer Huff Lexer Changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants