Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design doc on reusing typechecking results #17368

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

psfinaki
Copy link
Member

@psfinaki psfinaki commented Jun 28, 2024

The design for #17260.

Copy link
Contributor

✅ No release notes required

docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
docs/reusing-typecheck-results.md Outdated Show resolved Hide resolved
@auduchinok
Copy link
Member

auduchinok commented Jul 24, 2024

@psfinaki Thanks for starting this initiative, this may noticeably improve things!

I can add two things to consider:

  • Reusing type check info when non-F# projects are referenced

    Rider and Visual Studio both produce in-memory metadata for referenced C#/VB.NET projects. The approaches are different, but some of the issues should be similar.
    FCS uses in-memory metadata timestamp which depends on the project files, while fsc uses project output assembly timestamp. These two timestamps are likely to differ the most of the time, which would prevent us from reusing cached type check data for referencing F# projects. It would be nice if we found a way to reuse type check info when non-F# projects are referenced.

  • Different conditional compilation between FCS in Rider and fsc

    We use --noconditionalerasure flag to properly analyze erased symbols in the tooling. When type check caches are reused we should not have such difference between typed trees. I propose we change the erasure logic here: we should always keep these symbols in the typed trees and erase them later during IL generation instead.

@psfinaki psfinaki changed the title [WIP] Design doc on reusing typecheck results Design doc on reusing typecheck results Aug 27, 2024
@psfinaki psfinaki marked this pull request as ready for review August 27, 2024 12:31
@psfinaki psfinaki requested a review from a team as a code owner August 27, 2024 12:31
@psfinaki psfinaki enabled auto-merge (squash) September 17, 2024 13:24
@psfinaki psfinaki changed the title Design doc on reusing typecheck results Design doc on reusing typechecking results Sep 26, 2024

Optimizations are not relevant in the dev loop with run/debug/test cycles so we won't take those into account.

## Implementation plan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also please add any potential challenges in implementing each stage?

docs/reusing-typechecking-results.md Show resolved Hide resolved
docs/reusing-typechecking-results.md Outdated Show resolved Hide resolved

That means we can force-gen and save the graph which will allow us to skip retypechecking if we detect that the graph is not changed. We should also track all the compilation information (the argument string).

This step won't bring big observable benefits, yet it will create necessary MSBuild hooks to communicate the intermediate files folder towards the compiler, add time-based and hash-based cache invalidation logic, and create testing rails which will include the `clean` and `rebuild` tests to make sure the cache is easily invalidated on demand.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time-based and hash-based cache invalidation logic

This is the fun part. The hash of each file should contain also all its dependencies. It's kinda the same problem FSharpProjectSnapshot is trying to solve. It would be nice if we could somehow unify this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New
Development

Successfully merging this pull request may close these issues.

7 participants