Skip to content

Hoisting locals bound in several branches is quadratic in the number of names (checker and codegen walks) #3083

Closed

Description

@nicolas-maman

Hoisting a local bound in several branches is quadratic in the number of such names.

The early pass's per-binding join was quadratic in the bindings (shipped in v0.838.0; fixed on the next batch: 6000 re-bindings, 6.6 s down to 0.12 s). The checker's and codegen's per-name hoisting walks remain, each walking the function body once per name: a function with 3000 such names takes 1.6 s with that fix, 5.0 s on v0.838.0.

Expected: one walk per function body, the joins kept per name.

Activity

  1. nicolas-maman commented on Oct 26, 2026

    @nicolas-maman
    CollaboratorAuthor

    Fixed by 0e1d826, "Hoisting reads each name from one walk of its body, at any number of names (#3083)", which merged with #3101 (the commit named the issue without a closing keyword, so it stayed open). Checked on main at 00df4c7 (0.848.0), MinGW gcc, Windows: tests/integration/hoist_scaling passes.

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

    bugSomething isn't workingcompiler

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions