Skip to content

audit-graphs now walks the corpus three times (7.9s -> 12.4s), and qc runs it twice #373

Description

@realmarcin

Found reviewing #366.

scripts/audit_causal_graphs.py now parses every data/traits/**/*.yaml three times per run:

pass added by
audit() original
connectivity_rows() #363
node_type_index() #366

Measured on this corpus (477 records, 353 graphs):

main (2 walks)   real 7.92
#366 (3 walks)   real 12.36     +56%

grep -c 'rglob("\*.yaml")' scripts/audit_causal_graphs.py → 3.

It compounds: just qc runs audit-graphs directly and again inside audit-derived-reports to diff against git, so qc pays roughly +9s. Each pass re-reads and re-parses the same YAML for a different projection.

Fix: load the corpus once into [(rel_path, doc)] and pass it to all three, which also removes the risk of the three walks disagreeing about which files they saw (they each re-implement the rglob + safe_load + isinstance(doc, dict) guard). #363 already extracted _topology() for exactly this "the ratchet and the measurement must not drift" reason; this is the same argument one level up.

Not urgent — 12s is tolerable and nothing is wrong, just wasteful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions