Skip to content

user configurable size_type #379

Description

@stefankueng

Currently the size type is set to uint64_t in helpers.hpp.
But this is a very big value and requires 8 bytes just to store a size. When serializing a million objects with many short strings that can add up to a lot of overhead (binary serializer).
In my project, using uint32_t instead of uint64_t made a difference of 93MB of the resulting serialized stream.

I suggest to make this configurable:

#ifndef CEREAL_SIZE_TYPE
  using size_type = uint64_t;
#else
  using size_type = CEREAL_SIZE_TYPE;
#endif

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions