Skip to content

refactor(kv-ir): Make key_name_buffer a member variable of Deserializer to avoid repeated memory reallocation #2249

@coderabbitai

Description

@coderabbitai

Summary

In components/core/src/clp/ffi/ir_stream/Deserializer.hpp, the key_name_buffer variable inside Deserializer::deserialize_next_ir_unit is currently declared as a local std::string within the IrUnitType::SchemaTreeNodeInsertion case block:

case IrUnitType::SchemaTreeNodeInsertion: {
    std::string key_name_buffer;
    ...
}

This causes a heap allocation on every call to deserialize_next_ir_unit that encounters a schema tree node insertion IR unit.

Proposed Change

Move key_name_buffer to be a member variable of Deserializer, and clear it at the start of each use. This allows the allocated memory to be reused across calls, avoiding repeated heap allocations.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions