From 3f9a2f04d7d85581031746616ca068556c280bff Mon Sep 17 00:00:00 2001 From: howsohazard <143410553+howsohazard@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:31:55 -0500 Subject: [PATCH] 22278: Reduces transactional load time (#308) --- src/Amalgam/Parser.cpp | 2 ++ src/Amalgam/evaluablenode/EvaluableNodeManagement.cpp | 6 ------ src/Amalgam/evaluablenode/EvaluableNodeManagement.h | 11 ++--------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/Amalgam/Parser.cpp b/src/Amalgam/Parser.cpp index 8cdb5a05..31f57ac6 100644 --- a/src/Amalgam/Parser.cpp +++ b/src/Amalgam/Parser.cpp @@ -121,6 +121,8 @@ std::tuple, size_t> Parser::Par { preevaluationNodes.clear(); parentNodes.clear(); + //since the type of parentNodes can be expensive to iterate over, reduce the size + parentNodes.shrink_to_fit(); EvaluableNode *top_node = ParseCode(); diff --git a/src/Amalgam/evaluablenode/EvaluableNodeManagement.cpp b/src/Amalgam/evaluablenode/EvaluableNodeManagement.cpp index f03070de..81721a75 100644 --- a/src/Amalgam/evaluablenode/EvaluableNodeManagement.cpp +++ b/src/Amalgam/evaluablenode/EvaluableNodeManagement.cpp @@ -11,12 +11,6 @@ Concurrency::ReadWriteMutex EvaluableNodeManager::memoryModificationMutex; #endif - -#if defined(MULTITHREAD_SUPPORT) || defined(MULTITHREAD_INTERFACE) -thread_local -#endif -EvaluableNode::ReferenceAssocType EvaluableNodeManager::nodeToParentNodeCache; - const double EvaluableNodeManager::allocExpansionFactor = 1.5; EvaluableNodeManager::~EvaluableNodeManager() diff --git a/src/Amalgam/evaluablenode/EvaluableNodeManagement.h b/src/Amalgam/evaluablenode/EvaluableNodeManagement.h index ba41e66e..8ba1c950 100644 --- a/src/Amalgam/evaluablenode/EvaluableNodeManagement.h +++ b/src/Amalgam/evaluablenode/EvaluableNodeManagement.h @@ -658,8 +658,8 @@ class EvaluableNodeManager if(tree == nullptr) return; - nodeToParentNodeCache.clear(); - UpdateFlagsForNodeTreeRecurse(tree, nullptr, nodeToParentNodeCache); + EvaluableNode::ReferenceAssocType node_to_parent_cache; + UpdateFlagsForNodeTreeRecurse(tree, nullptr, node_to_parent_cache); } //updates idempotency flags for tree and returns true if tree is idempotent @@ -1105,13 +1105,6 @@ class EvaluableNodeManager //only allocated if needed std::unique_ptr nodesCurrentlyReferenced; - //buffer used for updating EvaluableNodeFlags, particularly UpdateFlagsForNodeTree -#if defined(MULTITHREAD_SUPPORT) || defined(MULTITHREAD_INTERFACE) - thread_local -#endif - static EvaluableNode::ReferenceAssocType nodeToParentNodeCache; - - //extra space to allocate when allocating static const double allocExpansionFactor; };