From 58616a29aa278048acc583163fa418e7e70d4f00 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Tue, 5 Sep 2023 22:23:31 -0700 Subject: [PATCH] Avoid store-load penalty on cursor->parent This reclaims the performance lost in PCDATA reorganization and gains a little more on top of that. --- src/pugixml.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index 2129e07..6690df7 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -3503,12 +3503,13 @@ PUGI_IMPL_NS_BEGIN } else { + xml_node_struct* prev_cursor = cursor; PUGI_IMPL_PUSHNODE(node_pcdata); // Append a new node on the tree. cursor->value = parsed_pcdata; // Save the offset. merged = parsed_pcdata; // Used for parse_merge_pcdata above, cheaper to save unconditionally - PUGI_IMPL_POPNODE(); // Pop since this is a standalone. + cursor = prev_cursor; // Pop since this is a standalone. } if (!*s) break;