Skip to content

Explicit byte size accounting #2689

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

Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Feb 27, 2020

This copies the existing byte size accounting from the FieldValue classes and exposes it via Proto-only methods.

Copy link
Contributor

@var-const var-const left a comment

Choose a reason for hiding this comment

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

Sorry about the slow review.

function estimateArrayByteSize(arrayValue: api.ArrayValue): number {
let size = 0;
for (const value of arrayValue.values || []) {
size += estimateByteSize(value);
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional: this looks like reduce, though it doesn't look like it would change things substantially.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like it. Rewritten.

return `geo(${geoPoint.latitude},${geoPoint.longitude})`;
}

function canoifyMap(mapValue: api.MapValue) : string {
function canoifyMap(mapValue: api.MapValue): string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: typo (s/canoify/canonify/).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@schmidt-sebastian schmidt-sebastian changed the base branch from mrschmidt/rewritefieldvalue-8 to mrschmidt/rewritefieldvalue March 4, 2020 23:36
@schmidt-sebastian schmidt-sebastian merged commit 2eeb0eb into mrschmidt/rewritefieldvalue Mar 4, 2020
@firebase firebase locked and limited conversation to collaborators Apr 4, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/rewritefieldvalue-9 branch November 9, 2020 22:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants