Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: assert single component-decl tree materialization on cold load
Tighten the call-count check so near-quadratic cold loads cannot pass.
  • Loading branch information
ljodea committed Jul 31, 2026
commit afe98d266a8e9aaa116d10eefec42991c01ea0b1
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ def counting_component_decl_tree(self: ComponentTree):
):
tree.build_defs()

# One materialization is enough to seed cacheable child decls for
# the rest of the load. A few more is fine if root / path lookup
# paths need a second pass; once-per-sibling is not.
assert call_count < n_siblings, (
# One materialization seeds cacheable child decls for the rest of
# the load. A looser bound (e.g. call_count < n) would still pass
# near-quadratic cold loads and miss regressions.
assert call_count == 1, (
f"_component_decl_tree was called {call_count} times for "
f"{n_siblings} sibling components (expected O(1) materializations, "
f"not once per component)"
f"{n_siblings} sibling components (expected one materialization)"
)


Expand Down