Skip to content

Improved XMLNode::~XMLNode perfomance #1044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IMBIGFISH4
Copy link

XMLNode::~XMLNode uses interface method DeleteChildren(), which iteratively removes the first child until the list is empty. Each single removal performs additional checks and keeps _firstChild and _lastChild links in a consistent state. This leads to a performance penalty.

The proposed patch solves this problem by iterating the list of the children and directly destroying them without keeping links in a consistent state.

The performance boost we gained on xmltest is:

  • 3% for my laptop (x86_64)
  • 9% for bananapi f3 board (riscv64)

XMLNode::~XMLNode uses interface method DeleteChildren(), which
iteratively removes the first child until the list is empty. Each single
removal performs additional checks and keeps _firstChild and _lastChild
links in a consistent state. This leads to a performance penalty.

The proposed patch solves this problem by iterating the list of the
children and directly destroying them without keeping links in a
consistent state.

The performance boost we gained on xmltest is:
- 3% for my laptop (x86_64)
- 9% for bananapi f3 board (riscv64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant