Skip to content

"Map" objects could switch to "array" objects on demand #19

Description

@skunkiferous

A normal "array" object just writes each field one after the other. So we do not save on "default value" fields, be the code is simple and probably runs fast.

"Map" objects, OTOH, normally only write non-default value. Since MessagePack requires us to specify the size of an array/map/raw before creating it, we are required to go over the fields of a "map" object twice; Once to count how many fields are non-default, and once to actually write them. Given this knowledge, we can compute if the map-form, or the array form, uses less space. And so we might have objects that support both forms of serialisation, and chose the most optimal at runtime, before actually writing themselves.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions