Skip to content
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

OriginalXmlProperties optimization #40500

Merged
merged 1 commit into from Dec 8, 2020

Conversation

elpaso
Copy link
Contributor

@elpaso elpaso commented Dec 8, 2020

Dramatic speed improvement in XML original properties storage.

The original implementation used a call to QDomNodeList::count() method
that calls QDomNodeListPrivate::createList() -> DETACH!

By using a while loop we prevent the detach and it's more than 10 times faster.

Dramatic speed improvement in XML original properties storage.

The original implementation used a call to QDomNodeList::count() method
that calls QDomNodeListPrivate::createList() -> DETACH!

By using a while loop we prevent the detach and it's more than 10 times faster.
@elpaso elpaso added the Optimization I feel the need... the need for speed! label Dec 8, 2020
@github-actions github-actions bot added this to the 3.18.0 milestone Dec 8, 2020
@elpaso elpaso merged commit af0247e into qgis:master Dec 8, 2020
@elpaso elpaso deleted the speedup-original-xml-properties branch December 8, 2020 17:19
@nirvn
Copy link
Contributor

nirvn commented Dec 8, 2020

@elpaso , I was planning to fix that one if you didn't address it, very good :)

This can be optimized a bit more:

  • the original xml stuff is only ever used for invalid layers when the project is loaded, therefore you can skip the creation of this original xml altogether if the matching layer isValid()
  • maybe more of a micro optimization but you could also avoid creating a whole DOM document and instead use a ptebuilt string within which you'd insert your XML node

@nyalldawson
Copy link
Collaborator

Manually backported to #40370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Optimization I feel the need... the need for speed!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants