Skip to content

[RFC] Pass an FSharpProjectOptions down into the lint machinery when available#845

Draft
Numpsy wants to merge 1 commit intofsprojects:masterfrom
Numpsy:pass_down_options
Draft

[RFC] Pass an FSharpProjectOptions down into the lint machinery when available#845
Numpsy wants to merge 1 commit intofsprojects:masterfrom
Numpsy:pass_down_options

Conversation

@Numpsy
Copy link
Contributor

@Numpsy Numpsy commented Feb 15, 2026

Rather than reading it from FSharpCheckProjectResults on every use, which appears to have a substantional performance cost.

refs #770 (specifically #770 (comment))

This is an attempt at making the FSharpProjectOptions directly available through the lint options and then constructing it once rather than on every call which seems to have a substantional performance impact.

This is more like how its done in the F# Analyzers SDK, where the project check results and the project options are both passed down from the top.

I'm also reminded when looking that they also have a ProjectFileName property on the top level options so that consumers don't need to worry about where it came from. That could potentially be done here given that all consumers as it stands only want the file name, though having the whole options available is more extensible for the future.

This change does seem to have a positive performance impact with the current code using FCS 43.9 as well as removing the large regression when using 43.10 -

Build of just this change - https://github.com/Numpsy/FSharpLint/actions/runs/22036364219 (this takes a couple of minutes off the runtime of the self-lint step in the CI runs as compared to the current master)
Build using this change and FCS 43.10.103 - https://github.com/Numpsy/FSharpLint/actions/runs/21925277621

Rather than reading it from FSharpCheckProjectResults on every use,
which appears to have a substantional performance cost.

refs fsprojects#770
GlobalConfig: Rules.GlobalRuleConfig
TypeCheckResults: FSharpCheckFileResults option
ProjectCheckResults: FSharpCheckProjectResults option
ProjectOptions: Lazy<FSharpProjectOptions option>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is Lazy beacuse if it's expensive to calculate and only used by a few rules then the work can be avoided in cases where those rules aren;t being run)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant