-
Notifications
You must be signed in to change notification settings - Fork 5
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
ArrayView instead of Array for repeated scalar fields #30
Comments
When deserializing a packed repeated scalar field we don't know how many repeated elements are in the field in advance, so we wouldn't be able to preallocate exactly the right size |
Wait that's not quite true, we know the length of the array, and if the element type is fixed-width (double, float, fixed32, fixed64, sfixed32, sfixed64) then we can just divide by the byte width of the array element type to get the number of repeated elements. That still leaves the problem of variable-width-type packed repeated fields though. |
I wonder if it would be a worthwhile performance improvement to represent repeated scalar fields with
ArrayView
instead ofArray
.For example a repeated double message field would be type
Float64Array
instead ofArray Number
.We already have special cases for packed repeated scalar fields so maybe this would be easy.
The text was updated successfully, but these errors were encountered: