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

refactor: Optimize FieldMask instantiation #1536

Merged
merged 2 commits into from
Jan 19, 2024

Conversation

tom-andersen
Copy link
Contributor

@tom-andersen tom-andersen commented Jan 19, 2024

Optimization does 2 things:

  1. Avoid creating intermediary collections. Simply create a TreeSet that is used in FieldMask constructor.
  2. Instead of adding FieldPaths to an intermediary collection and then removing them afterwards, simply filter FieldPaths as part of TreeSet creation.

@product-auto-label product-auto-label bot added size: s Pull request size is small. api: firestore Issues related to the googleapis/java-firestore API. labels Jan 19, 2024
@tom-andersen tom-andersen changed the title Optimize FieldMask instantiation refactor: Optimize FieldMask instantiation Jan 19, 2024
@tom-andersen tom-andersen marked this pull request as ready for review January 19, 2024 19:47
@tom-andersen tom-andersen requested a review from a team as a code owner January 19, 2024 19:47
@tom-andersen tom-andersen added the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 19, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Jan 19, 2024
Copy link
Contributor

@dconeybe dconeybe left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for this improvement, and for gracefully pointing out my uninformed review comments!

@dconeybe dconeybe assigned tom-andersen and unassigned dconeybe Jan 19, 2024
@tom-andersen tom-andersen merged commit f41adf7 into main Jan 19, 2024
23 checks passed
@tom-andersen tom-andersen deleted the tomandersen/optimizeFieldMaskLogic branch January 19, 2024 21:32
tom-andersen added a commit that referenced this pull request Jan 22, 2024
* Optimize FieldMask instantiation

* Pretty
tom-andersen added a commit that referenced this pull request Jan 24, 2024
* Thread safe UpdateBuilder

* Add comment

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* chore: add an unmanaged dependency check (#1532)

* refactor: Optimize FieldMask instantiation (#1536)

* Optimize FieldMask instantiation

* Pretty

* Use synchronize

* Update comment

* Make sure commit prevents writes.

* Pretty

* Refactor

* Add comments and make committed volatile.

* Make WriteOperation immutable.

* Refactor

* fix(deps): Update the Java code generator (gapic-generator-java) to 2.32.0 (#1534)

* chore: Add FindNearest API to the preview branch
docs: Improve the documentation on Document.fields

PiperOrigin-RevId: 599602467

Source-Link: googleapis/googleapis@d32bd97

Source-Link: googleapis/googleapis-gen@0545ffc
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDU0NWZmYzQ4OGI4MmQzYTQ3NzExMThjOTIzZDY0Y2QwYjc1OTk1MyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix(deps): Update the Java code generator (gapic-generator-java) to 2.32.0

PiperOrigin-RevId: 599914188

Source-Link: googleapis/googleapis@17e6661

Source-Link: googleapis/googleapis-gen@d86ba5b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDg2YmE1YmU1MzdlNDg5NDM1MTA1Y2E4NTU2NmNjNDEwMzMwMWFiYSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

* test(deps): update dependency com.google.truth:truth to v1.3.0 (#1538)

* make some methods static: applyFieldMask() and convertToFieldPaths()

* Comment

* Inline

* use explicit synchronization

* Review feedback

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Joe Wang <106995533+JoeWang1127@users.noreply.github.com>
Co-authored-by: gcf-owl-bot[bot] <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: Denver Coneybeare <dconeybe@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/java-firestore API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants