diff --git a/Code/Framework/AzCore/AzCore/DOM/DomPatch.cpp b/Code/Framework/AzCore/AzCore/DOM/DomPatch.cpp index 44c16baa16..f89cb313e7 100644 --- a/Code/Framework/AzCore/AzCore/DOM/DomPatch.cpp +++ b/Code/Framework/AzCore/AzCore/DOM/DomPatch.cpp @@ -14,21 +14,21 @@ namespace AZ::Dom { PatchOperation::PatchOperation(Path destinationPath, Type type, Value value) - : m_domPath(destinationPath) + : m_domPath(AZStd::move(destinationPath)) , m_type(type) - , m_value(value) + , m_value(AZStd::move(value)) { } PatchOperation::PatchOperation(Path destinationPath, Type type, Path sourcePath) - : m_domPath(destinationPath) + : m_domPath(AZStd::move(destinationPath)) , m_type(type) - , m_value(sourcePath) + , m_value(AZStd::move(sourcePath)) { } PatchOperation::PatchOperation(Path destinationPath, Type type) - : m_domPath(destinationPath) + : m_domPath(AZStd::move(destinationPath)) , m_type(type) { } @@ -690,22 +690,22 @@ namespace AZ::Dom auto Patch::begin() const -> OperationsContainer::const_iterator { - return m_operations.cbegin(); + return m_operations.begin(); } auto Patch::end() const -> OperationsContainer::const_iterator { - return m_operations.cend(); + return m_operations.end(); } auto Patch::cbegin() const -> OperationsContainer::const_iterator { - return m_operations.cbegin(); + return m_operations.begin(); } auto Patch::cend() const -> OperationsContainer::const_iterator { - return m_operations.cend(); + return m_operations.end(); } size_t Patch::size() const diff --git a/Code/Framework/AzCore/AzCore/DOM/DomPatch.h b/Code/Framework/AzCore/AzCore/DOM/DomPatch.h index 633a611c73..40ef725b57 100644 --- a/Code/Framework/AzCore/AzCore/DOM/DomPatch.h +++ b/Code/Framework/AzCore/AzCore/DOM/DomPatch.h @@ -10,6 +10,7 @@ #include #include +#include namespace AZ::Dom { @@ -108,12 +109,12 @@ namespace AZ::Dom //! The current state of a Patch application operation. struct PatchApplicationState { + //! The outcome of the last operation, may be overridden to produce a different failure outcome. + PatchOperation::PatchOutcome m_outcome; //! The patch being applied. const Patch* m_patch = nullptr; //! The last operation attempted. const PatchOperation* m_lastOperation = nullptr; - //! The outcome of the last operation, may be overridden to produce a different failure outcome. - PatchOperation::PatchOutcome m_outcome; //! The current state of the value being patched, will be returned if the patch operation succeeds. Value* m_currentState = nullptr; //! If set to false, the patch operation should halt. @@ -134,7 +135,7 @@ namespace AZ::Dom { public: using StrategyFunctor = AZStd::function; - using OperationsContainer = AZStd::vector; + using OperationsContainer = AZStd::deque; Patch() = default; Patch(const Patch&) = default; @@ -193,6 +194,7 @@ namespace AZ::Dom struct DeltaPatchGenerationParameters { static constexpr size_t NoReplace = AZStd::numeric_limits::max(); + static constexpr size_t AlwaysFullReplace = 0; //! The threshold of changed values in a node or array which, if exceeded, will cause the generation to create an //! entire "replace" oepration instead. If set to NoReplace, no replacement will occur. diff --git a/Code/Framework/AzCore/Tests/DOM/DomPathBenchmarks.cpp b/Code/Framework/AzCore/Tests/DOM/DomPathBenchmarks.cpp index c3c8139f6c..4741900aa1 100644 --- a/Code/Framework/AzCore/Tests/DOM/DomPathBenchmarks.cpp +++ b/Code/Framework/AzCore/Tests/DOM/DomPathBenchmarks.cpp @@ -106,12 +106,12 @@ namespace AZ::Dom::Benchmark for (auto _ : state) { - name == name; - name == index; - name == endOfArray; - index == index; - index == endOfArray; - endOfArray == endOfArray; + benchmark::DoNotOptimize(name == name); + benchmark::DoNotOptimize(name == index); + benchmark::DoNotOptimize(name == endOfArray); + benchmark::DoNotOptimize(index == index); + benchmark::DoNotOptimize(index == endOfArray); + benchmark::DoNotOptimize(endOfArray == endOfArray); } state.SetItemsProcessed(6 * state.iterations());