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

Metadata add vs set #283

Closed
Americas opened this issue Oct 18, 2021 · 3 comments
Closed

Metadata add vs set #283

Americas opened this issue Oct 18, 2021 · 3 comments
Assignees

Comments

@Americas
Copy link
Contributor

When calling the Metadata.create() defined in this file the newly created Metadata object is populated by calling add, which first does a get to see if the property is set, and only then performs the set.

For an empty Metadata object, this is useless, why not use the set method, and skip the get call?

@anonrig anonrig self-assigned this Oct 18, 2021
@anonrig
Copy link
Member

anonrig commented Oct 18, 2021

Thank you for the issue and question. Since keys in the metadata parameter is unique, there's no need to check for existing keys. You're right. 🎉

I believe this will improve the performance of creating metadatas. Can you create a pull request for this?

@Americas
Copy link
Contributor Author

Yes, I can do the change 😄

@anonrig
Copy link
Member

anonrig commented Oct 19, 2021

Thank you for your contribution!

@anonrig anonrig closed this as completed Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants