Mentions légales du service

Skip to content

Fix performance problem with Config objects

E Madison Bray requested to merge embray/nested-config-bug into master

This fixes a problem where Config objects (and the underlying DeepChainMap implementation) could become very deeply nested, hurting performance, especially when iterating over the Config

There were many cases that are roughly equivalent to:

config = Config(some_previous_config)

This means that

config.maps == [some_previous_config]

I.e. there is only one map in the chain map, which itself is a chain map. This could end up becoming very deeply nested, apparently, especially during schema validation. I had one case of an empty config (Config({})) which had a 15-deep tree of nested Configs before getting to the original underlying empty {}

In Config.init we also need to account for this workaround by making sure to grab the correct filename from the original Config, if there is one.

Merge request reports

Loading