Skip to content

WIP: Some more microoptimisations

Description

This branch contains yet more small optimisations, some uncontroversial, some controversial.

Ideally each is independent.

The optimisations were identified by using a bstgen'd project of 25000 elements in dot formation and then running bst build build_all.bst with self._run() commented out in _stream.py::Stream.build().

Changes proposed in this merge request:

  • Only retrieve provenance in _yaml.py::node_get() when it's needed (saves 15s in testing)
  • Open-code conditions in _yaml.py::node_sanitize() to reduce reliance on isinstance (saves 13s in testing)
  • Optimise for cache key generation by pre-sanitising data and carefully modifying it when needed (saves 8s in testing)
  • Remove reliance on isinstance() in _yaml.py::{node,list}_{chain_,}copy (saves 9s to 12s in testing)

This merge request, when approved, will improve matters for #466 (closed)


Edited by Daniel Silverstone

Merge request reports