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

Reduce compiler allocations #1530

Merged

Conversation

wixoaGit
Copy link
Member

@wixoaGit wixoaGit commented Nov 6, 2023

Does a few things:

  • Turn Token into a struct
  • Cache a StringBuilder in DMPreprocessorLexer and DMLexer
  • Turn DMVisitorExpression into a static DMExpressionBuilder class

Reduces the compiler's allocations on /tg/ from 3.9GB to 2.5GB.

It's not necessary to be creating a new one for every token that uses it
Can't do this in `LexString()` unfortunately because it has a nested `NextToken()` call
Not a DMASTVisitor
Static class, doesn't need to be instantiated/allocated every time it's used
@wixoaGit wixoaGit merged commit 03fcfcb into OpenDreamProject:master Nov 8, 2023
4 checks passed
@wixoaGit wixoaGit deleted the reduce_compiler_allocations branch November 8, 2023 20:17
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