-
Notifications
You must be signed in to change notification settings - Fork 934
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
Explicit byte size accounting #2689
Conversation
The goal of this PR is to support fast comparisons for Timestamp types when the Timestamps are represented as ISO dates
There was a problem hiding this 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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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/).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
This copies the existing byte size accounting from the FieldValue classes and exposes it via Proto-only methods.