_yaml.py: Implement `get()` for `ChainMap`
Description
The ChainMap
in Python's core implements .get()
as:
def get(self, key, default=None):
return self[key] if key in self else default
This is a use of __contains__
followed by __getitem__
if present. This is expensive.
As such, let's correct that.
This change improves performance of bst build
pre-scheduler by approximately 40s in my test case (nearly 50% of node_get()
's total runtime cost)
Changes proposed in this merge request:
- Implement
.get()
in_yaml.py::ChainMap
This merge request, when approved, will improve matters for #466 (closed)
Edited by Daniel Silverstone