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

Faster Ast.zig #21381

Closed
wants to merge 5 commits into from
Closed

Faster Ast.zig #21381

wants to merge 5 commits into from

Conversation

RetroDev256
Copy link
Contributor

I managed to eek a little more speed out of ast-check:
image
("old-zig" in this is master as of b817823, "new-zig" is this PR)

While I haven't tested it, this should also reduce a little memory usage after generating the AST.

const estimated_token_count = @max(64, bytes_left / 8);
const estimated_total = tokens.len + estimated_token_count;
try tokens.ensureTotalCapacity(gpa, estimated_total);
for (0..estimated_token_count) |_| {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, that's really clever. 👏 👏

@RetroDev256 RetroDev256 force-pushed the faster-ast branch 4 times, most recently from 4dd48f8 to a65e0e7 Compare September 11, 2024 06:33
ArrayList/MultiArrayList .shrinkAndFree can swallow an OOM, but this is correct.
lib/std/hash_map.zig Outdated Show resolved Hide resolved
@RetroDev256
Copy link
Contributor Author

This PR could be improved. I found a few more optimizations.

@RetroDev256 RetroDev256 deleted the faster-ast branch September 18, 2024 01:14
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.

4 participants