Commit 09e6089
committed
Skip config loading for Configurables with no matching config
Configurable._load_config computed traits(config=True) and entered
hold_trait_notifications() unconditionally, even for the many leaf
Configurables in an Application graph whose config has no keys matching the
instance. It now computes my_config first and returns early when it is empty,
before doing any of that work.
Also removes a dead `section_names = self.section_names()` local that was
computed (section_names() walks the MRO with issubclass checks, twice per
instance) but never used — _find_my_config recomputes it internally. The
section_names parameter is kept in the signature for backward compatibility.
Measured (Python 3.11): ~1.2x on leaf Configurables with no matching config.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaKDJ3fpGf7anQeYeBsJbk1 parent 4e62303 commit 09e6089
1 file changed
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
174 | 181 | | |
175 | 182 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | 183 | | |
181 | 184 | | |
182 | 185 | | |
| |||
0 commit comments