Turning on scan (U013) over bolt's own tree found about 54 per-item scans. Nearly all walk small bounded lists (a def's parameters, import aliases, SPEC rows), so scan stays opt-in and is off in bolt's bolt.bend. These four walk something that grows with the input and are worth fixing:
rewalk: other_full, earlier_one and report_one walk the piece's tree once per call site.
bind.refresh: looks up binder(binds, …) for each environment entry.
digest.laws_of: calls doc_at(items, …) for each law.
unused: calls reportable(…, fl) for each binder.
The fix in each case is to index once outside the loop, or merge two sorted walks, as unused's trie of use targets already does. Run bolt with def scan() -> String: "warn" in a scratch bolt.bend to list them.
Turning on
scan(U013) over bolt's own tree found about 54 per-item scans. Nearly all walk small bounded lists (a def's parameters, import aliases, SPEC rows), soscanstays opt-in and is off in bolt'sbolt.bend. These four walk something that grows with the input and are worth fixing:rewalk:other_full,earlier_oneandreport_onewalk the piece's tree once per call site.bind.refresh: looks upbinder(binds, …)for each environment entry.digest.laws_of: callsdoc_at(items, …)for each law.unused: callsreportable(…, fl)for each binder.The fix in each case is to index once outside the loop, or merge two sorted walks, as
unused's trie of use targets already does. Runboltwithdef scan() -> String: "warn"in a scratchbolt.bendto list them.