Skip to content

Commit

Permalink
Avoid store-load penalty on cursor->parent
Browse files Browse the repository at this point in the history
This reclaims the performance lost in PCDATA reorganization and gains a
little more on top of that.
  • Loading branch information
zeux committed Sep 6, 2023
1 parent dfb2b7f commit 58616a2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pugixml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 58616a2

Please sign in to comment.