Skip to content

Conversation

dvdkon
Copy link

@dvdkon dvdkon commented Sep 11, 2025

I've been working on speeding up the build of QGIS' Python bindings and during that work, I've found a few places where SIP was needlessly slow.

The largest improvements are in places where SIP was doing some O(n) lookup in a loop. I've managed to speed up most of these by keeping a transparent index of various parts of Specification and then simply asking the index instead of looping over all items.

Some smaller improvements came from using identity comparison instead of equality and improving the name cache packer.

Together, my not-so-scientific tests on QGIS' bindings show a roughly 5x improvement in sip-build runtime (sans compilation).

@philthompson10
Copy link
Contributor

Thanks for this. I won't be able to review it properly for a couple of weeks. Some initial stylistic feedback:

  • I want to keep specification.py as clean as possible, so your extra tooling should go in a separate file.
  • Every class and callable should have a docstring giving an informal description of its purpose written using proper English sentences.

@dvdkon
Copy link
Author

dvdkon commented Sep 16, 2025

Thanks, I've moved the IndexedLists to a separate file and documented them in hopefully enough detail.

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.

2 participants