Skip to content

Parallel type checking #11550

@kerams

Description

@kerams

The recent awesome work on parallel parsing and IL gen got me thinking whether it would be feasible to parallelize type checking as well.

Given F#'s significant file order, if the compiler can quickly establish that file B can't possibly reference anything in file A declared directly above it, can't A and B be typechecked (and optimized) simultaneously? This would require an initial traversal of the AST in every file in order to create a file dependency graph. Specifically, things like this need to be checked:

  • If B opens a module or class defined in A, B depends on A
  • If A contains an AutoOpen that has immediate effect in B (because of overlapping namespaces, regardless of actual contents), B depends on A
  • If B references something from A using a qualified name, B depends on A

I think these can be gleaned from the untyped syntax tree alone, the question is whether it would be fast enough to offset the overhead and whether typechecking has a significant cost. Apologies in advance if there's a gaping flaw in here somewhere :).

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