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

Feature: User specified initial capacity for slices #410

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IshankGulati
Copy link

Description

This feature enhances the unmarshalling performance for slices when the estimated capacity is known in advance. By preallocating the slice with the estimated capacity, it minimizes the need for reallocations and reduces the copying of elements in the underlying array.

Key Improvements

  • Optimized memory allocation for slices with predictable sizes.
  • Reduced overhead from unnecessary reallocations and element copying during unmarshalling.

This was requested in #286

Added struct tag to enable custom initial capacity for slices
@IshankGulati
Copy link
Author

IshankGulati commented Jan 15, 2025

@rvasily Can you review?

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