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

Use Cons to save memory building contexts #88

Merged
merged 1 commit into from
Aug 22, 2024
Merged

Conversation

crisptrutski
Copy link
Collaborator

Closes #55

In my local profiling this saves about 8% of memory on the huge snowflake query.

@crisptrutski crisptrutski added .Team/BackendComponents optimization Make it go brrr, without changing behavior labels Aug 22, 2024
@crisptrutski crisptrutski self-assigned this Aug 22, 2024
Comment on lines -276 to +278
this.acc = (Acc) callback.invoke(acc, visitedItem, this.contextStack.toArray());
this.acc = (Acc) callback.invoke(acc, visitedItem, this.contextStack);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here's the big win - typically we have a lot more nodes being visited than scopes we shuffle between.

Copy link
Contributor

@tsmacdonald tsmacdonald left a comment

Choose a reason for hiding this comment

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

Neat!

@crisptrutski crisptrutski merged commit d95f197 into master Aug 22, 2024
4 checks passed
@crisptrutski crisptrutski deleted the context-svelte branch August 22, 2024 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimization Make it go brrr, without changing behavior .Team/BackendComponents
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize Context stack datastructures
2 participants