dotnet / dotnet/fsharp

Graph-based type-checking: overlap TcState construction with dependency graph construction

Open
#15,430 0 comments 0 reactions 0 assignees View on GitHub
Feature Improvement
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

When GraphBasedChecking is enabled, there is fair bit of preprocessing done, which only needs parsing results and not TcState and other objects.

Currently all these items are calculated first, before type-checking is started.

This issue is a suggestion to, in case of graph-based checking, run TcState generation task alongside graph resolution.

Here is a sample snapshot from compiling FCS. The selected fragment is the operations done after parsing, which are not necessary to do graph calculations (they are only needed after the dependency graph is established):
![image](https://github.com/dotnet/fsharp/assets/2478401/32fca722-f6a6-4f30-a885-d364729a8834)

An alternative approach would be to optimize this code. I can see a few low-hanging fruit, eg. file name checking:
![image](https://github.com/dotnet/fsharp/assets/2478401/6b09c03b-b531-4e0b-bc9a-835321c8524b)

Such optimizations would apply to both graph-based and sequential type-checking, but will not give as much benefit as parallelizing the work alongside graph calculation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.