Skip to content

measureRecord() is inefficient #337

@OlegMazurov

Description

@OlegMazurov

Problem

measureRecord() is used in sizing and writing protobuf objects. On complex objects, the method is invoked recursively via a lambda, which incurs CPU and allocation overhead. For message lists, additional allocation overhead comes from implicit iterators (see ProtoWriterTools.sizeOfMessageList()). The necessity to measure an object before allocating a buffer for its serialization doubles the cost of measureRecord() from its explicit and implicit invocations.

The current implementation becomes a major factor in performance impacts of new features in hedera-services.

Solution

Reconsider the current design and implementation of Codec.measureRecord().

Alternatives

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    PerformanceIssues related to performance concerns.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions