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

Avoid creating empty vectors in vector.Apply #5540

Merged
merged 1 commit into from
Dec 18, 2024
Merged

Conversation

nwt
Copy link
Member

@nwt nwt commented Dec 18, 2024

vector.Apply can create a large number of empty (zero-length) vectors through calls to vector.rip, generating substantial garbage. Fix that by changing rip to return nil instead of a slice of empty vectors, changing Apply to skip the recursive call when it sees a nil from rip and substitute a nil vector in place of the skipped call's result, and changing NewTagMap to tolerate nil vectors so NewDynamic will as well.

vector.Apply can create a large number of empty (zero-length) vectors
through calls to vector.rip, generating substantial garbage.  Fix that
by changing rip to return nil instead of a slice of empty vectors,
changing Apply to skip the recursive call when it sees a nil from rip
and substitute a nil vector in place of the skipped call's result, and
changing NewTagMap to tolerate nil vectors so NewDynamic will as well.
@nwt nwt requested a review from a team December 18, 2024 23:48
@nwt nwt merged commit ed7019a into main Dec 18, 2024
3 checks passed
@nwt nwt deleted the no-zero-length-vector-apply branch December 18, 2024 23:53
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