perf: collisions don't contain reserved names by default by software-dov · Pull Request #684 · googleapis/gapic-generator-python · GitHub
Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

perf: collisions don't contain reserved names by default#684

Merged
gcf-merge-on-green[bot] merged 3 commits into
googleapis:masterfrom
software-dov:collisions
Oct 27, 2020
Merged

perf: collisions don't contain reserved names by default#684
gcf-merge-on-green[bot] merged 3 commits into
googleapis:masterfrom
software-dov:collisions

Conversation

@software-dov

@software-dov software-dov commented Oct 23, 2020

Copy link
Copy Markdown
Contributor

The 'collisions' set does NOT contain RESERVED_NAMES; they are
combined at runtime when needed.

For a large real-world, this results in an order of magnitude
reduction in memory usage.
I'm not joking: Google Ads v5 uses 2.45 GB peak before this change
and 223 MB after.

Also contains changes to add __slots__ attributes to Metadata and Address. These are ancillary, optional, and open to negotiation.
In the above scenario, they reduce memory usage from 223 MB to 177 MB. If other people feel that the reduction in readability does not warrant the reduction in memory usage I am absolutely open to dropping that particular commit.

Includes other minor memory usage optimizations that collectively shave about 5 MB.

The 'collisions' set does NOT contain RESERVED_NAMES; they are
combined at runtime when needed.

For a large real-world, this results in an order of magnitude
reduction in memory usage.
I'm not joking: Google Ads v5 uses 2.45 GB before this change
and 223 MB after.
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 23, 2020
@codecov

codecov Bot commented Oct 23, 2020

Copy link
Copy Markdown

@busunkim96 busunkim96 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also contains changes to add slots attributes to Metadata and Address. These are ancillary, optional, and open to negotiation.
In the above scenario, they reduce memory usage from 223 MB to 177 MB. If other people feel that the reduction in readability does not warrant the reduction in memory usage I am absolutely open to dropping that particular commit.

I would personally prefer preserving readability.

Comment thread gapic/schema/metadata.py Outdated
Comment on lines +151 to +152

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps add a note that this is for memory usage?

@software-dov software-dov added the automerge Merge the pull request once unit tests and other checks pass. label Oct 27, 2020
@gcf-merge-on-green gcf-merge-on-green Bot merged commit 2ec6ea6 into googleapis:master Oct 27, 2020
@gcf-merge-on-green gcf-merge-on-green Bot removed the automerge Merge the pull request once unit tests and other checks pass. label Oct 27, 2020
gcf-merge-on-green Bot pushed a commit that referenced this pull request Oct 27, 2020
🤖 I have created a release \*beep\* \*boop\* 
---
### [0.35.9](https://www.github.com/googleapis/gapic-generator-python/compare/v0.35.8...v0.35.9) (2020-10-27)


### Performance Improvements

* collisions don't contain reserved names by default ([#684](https://www.github.com/googleapis/gapic-generator-python/issues/684)) ([2ec6ea6](https://www.github.com/googleapis/gapic-generator-python/commit/2ec6ea6835256c0d7b252e035cf4eac1ff442647))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants