Skip to content

Consider lazily deserializing non-scalar fields #713

@osa1

Description

@osa1

A colleague asked about this and I think it can be a good idea, and I don't know if this was considered before.

Message, map, packed repeated, and string fields can be lazily deserialized as their encoding have a length prefix so we can efficiently skip over those fields and copy the encodings to deserialize later.

(Instead of copying encodings, we could store a view into the original buffer, though that would keep the entire buffer alive until all of the lazy fields (including those in nested fields) are deserialized.)

This can improve app startup as we delay some of the deserialization costs to field access time.

Since _FieldSet already holds dynamic elements it shouldn't be too much worse to add another value class.

I wonder if this was considered before? @sigurdm @mraleph

Metadata

Metadata

Assignees

No one assigned

    Labels

    perfRelated to runtime performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions