Skip to content

compiler: optimise top level operations transformer #1055

Closed

Description

@josephjclark

The top level operations transformer currently traverses the whole AST looking for call expressions, and tries to decide if they're top level in scope.

But this can be expensive in large ASTs.

Maybe a better approach is:

  • Only visit the Program node
  • Iterate over the children of Program
  • Identify any ExpressionStatements with a CallExpression inside
  • Those are your top-level ops

This is a shallow top-down traversal and it's got to be a lot cheaper

Activity

  1. moved this from New Issues to Done in Coreon Oct 9, 2025
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

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions