From dcf5bb1f489c3ce952cf91153e13a393cae9ffd0 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Tue, 23 Jun 2026 00:37:48 -0500 Subject: [PATCH 1/2] Decorator: move CsProtocol::Value temporaries into the ext maps EventPropertiesDecorator builds a throwaway CsProtocol::Value (or the Part B map) for every event property and copy-assigned it into the ext/extPartB maps. Each value is a local that is not used after insertion, so move it instead of copying. CsProtocol::Value is a heavy type (vectors of attributes/PII plus strings), and this runs on the per-event decorate path. Pure move-instead-of-copy of throwaway locals; no interface or behavior change. EventProperties decorator/serialization tests (54) pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lib/decorators/EventPropertiesDecorator.hpp | 52 ++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/decorators/EventPropertiesDecorator.hpp b/lib/decorators/EventPropertiesDecorator.hpp index 5bb3e927a..80eb04120 100644 --- a/lib/decorators/EventPropertiesDecorator.hpp +++ b/lib/decorators/EventPropertiesDecorator.hpp @@ -187,11 +187,11 @@ namespace MAT_NS_BEGIN { temp.stringValue = v.to_string(); if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } } @@ -209,11 +209,11 @@ namespace MAT_NS_BEGIN { temp.stringValue = v.to_string(); if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } #if 0 /* v2 code */ if (v.piiKind != PiiKind_None) @@ -251,11 +251,11 @@ namespace MAT_NS_BEGIN { temp.stringValue = v.to_string(); if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } break; } @@ -266,11 +266,11 @@ namespace MAT_NS_BEGIN { temp.longValue = v.as_int64; if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } break; } @@ -281,11 +281,11 @@ namespace MAT_NS_BEGIN { temp.doubleValue = v.as_double; if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } break; } @@ -296,11 +296,11 @@ namespace MAT_NS_BEGIN { temp.longValue = v.as_time_ticks.ticks; if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } break; } @@ -311,11 +311,11 @@ namespace MAT_NS_BEGIN { temp.longValue = v.as_bool; if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } break; } @@ -345,11 +345,11 @@ namespace MAT_NS_BEGIN { temp.longArray.push_back(*v.as_longArray); if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } break; } @@ -360,11 +360,11 @@ namespace MAT_NS_BEGIN { temp.doubleArray.push_back(*v.as_doubleArray); if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } break; } @@ -375,11 +375,11 @@ namespace MAT_NS_BEGIN { temp.stringArray.push_back(*v.as_stringArray); if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } break; } @@ -398,11 +398,11 @@ namespace MAT_NS_BEGIN { temp.guidArray.push_back(values); if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } break; } @@ -413,11 +413,11 @@ namespace MAT_NS_BEGIN { temp.stringValue = v.to_string(); if (v.dataCategory == DataCategory_PartB) { - extPartB[k] = temp; + extPartB[k] = std::move(temp); } else { - ext[k] = temp; + ext[k] = std::move(temp); } } } @@ -427,8 +427,8 @@ namespace MAT_NS_BEGIN { if (extPartB.size() > 0) { ::CsProtocol::Data partBdata; - partBdata.properties = extPartB; - record.baseData.push_back(partBdata); + partBdata.properties = std::move(extPartB); + record.baseData.push_back(std::move(partBdata)); } // special case of CorrelationVector value From faca4482a8d4f42354ecf5f506d8ff659d571918 Mon Sep 17 00:00:00 2001 From: Bhagirath Mehta Date: Tue, 23 Jun 2026 01:01:38 -0500 Subject: [PATCH 2/2] Address Copilot comment: include for std::move The decorator now uses std::move; add the explicit include instead of relying on transitive includes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- lib/decorators/EventPropertiesDecorator.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/decorators/EventPropertiesDecorator.hpp b/lib/decorators/EventPropertiesDecorator.hpp index 80eb04120..de9fd7144 100644 --- a/lib/decorators/EventPropertiesDecorator.hpp +++ b/lib/decorators/EventPropertiesDecorator.hpp @@ -13,6 +13,7 @@ #include #include #include +#include namespace MAT_NS_BEGIN {