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

Added capacity to slice creation, when capacity is known #159

Merged
merged 1 commit into from
Oct 25, 2019

Conversation

vivekv96
Copy link
Contributor

Simple optimisation to reduce memory allocations and copying(while appending).

Copy link
Member

@josephlr josephlr left a comment

Choose a reason for hiding this comment

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

Nice fix, did you find this by reading the code? Or though some tooling?

@josephlr josephlr merged commit 5d888ac into google:master Oct 25, 2019
@vivekv96
Copy link
Contributor Author

@josephlr, I found this by reading the code, but I am thinking of writing a small script over the weekend that can help with these kind of micro optimisations.
Something that probably does a grep on open source Go projects and finds slices that are being used immediately without a capacity, not sure how the script should work exactly but should be a fun side project.

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.

2 participants