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
Summary
In
components/core/src/clp/ffi/ir_stream/Deserializer.hpp, thekey_name_buffervariable insideDeserializer::deserialize_next_ir_unitis currently declared as a localstd::stringwithin theIrUnitType::SchemaTreeNodeInsertioncase block:case IrUnitType::SchemaTreeNodeInsertion: { std::string key_name_buffer; ... }This causes a heap allocation on every call to
deserialize_next_ir_unitthat encounters a schema tree node insertion IR unit.Proposed Change
Move
key_name_bufferto be a member variable ofDeserializer, and clear it at the start of each use. This allows the allocated memory to be reused across calls, avoiding repeated heap allocations.References
UnstructuredIrDeserializerImplimplementation for unstructured IR deserialization (resolves #2096). #2227UnstructuredIrDeserializerImplimplementation for unstructured IR deserialization (resolves #2096). #2227 (comment)