Skip to content

perf(api,nbt): Avoid copying collections twice - #1446

Open
kermandev wants to merge 1 commit into
PaperMC:main/5from
kermandev:perf/avoid-redundant-copies
Open

kermandev wants to merge 1 commit into
PaperMC:main/5from
kermandev:perf/avoid-redundant-copies

Conversation

@kermandev

Copy link
Copy Markdown
Contributor

Several call sites copied a list or map immediately before handing it to a constructor that copies again, or copied a local that was already a fresh copy.

Give CompoundBinaryTagImpl a canonical constructor that copies, so its callers no longer have to hand it a map they own, and let both put(CompoundBinaryTag) overloads use putAll rather than copying the key set and looking every value up again.

Several call sites copied a list or map immediately before handing it to
a constructor that copies again, or copied a local that was already a
fresh copy.

Give CompoundBinaryTagImpl a canonical constructor that copies, so its
callers no longer have to hand it a map they own, and let both
put(CompoundBinaryTag) overloads use putAll rather than copying the key
set and looking every value up again.
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