Skip to content

perf: four per-item scans in bolt that scan (U013) found #228

Description

@ngngardner

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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