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

Huge performance drop for fsc.exe/dll #74286

Closed
dsyme opened this issue Aug 20, 2022 · 6 comments · Fixed by #74298
Closed

Huge performance drop for fsc.exe/dll #74286

dsyme opened this issue Aug 20, 2022 · 6 comments · Fixed by #74298

Comments

@dsyme
Copy link

dsyme commented Aug 20, 2022

Description

Tracking issue to cover dotnet/fsharp#13730

Between .NET 7 preview 2 and preview 3 the performance of the F# compiler (fsc.dll/fsc.exe) on large inputs dropped by about 8x (yes, 800% regression). This stems from region-based GC being enabled by default.

Details are above. Particular characteristics are

  • Large application liking to allocate 1GB+ of memory
  • Not Server mode GC
  • GC Batch mode enabled
  • Large sections have performance dominated by a single thread of execution (since large sections are not parallelized)

Previously .NET Framework and .NET Core GC has performed well with this application

NOTE: This was only noticed when previews 5 and preview 7 were inserted back to dotnet/fsharp and the F# compiler bootstrap was executed. Catching this much earlier would have been possible, e.g. via a .NET performance test that runs the latest inserted F# compiler on latest runtime.

Reproduction Steps

See repro steps in dotnet/fsharp#13730 for the particular case where the compiler is used to compile the F# compiler. We expect the same performance problems on any large inputs to the F# compiler.

Expected behavior

See repro steps in dotnet/fsharp#13730 where you can run the compiler with various version of .NET runtime by adjusting settings. Performance of the F# compiler should match previous versions

Actual behavior

Performance has degraded by about 8x, 200+ second generation GCs where previously there was one.

Regression?

Yes

Known Workarounds

No perfect workarounds.

  • Setting DOTNET_gcServer=1 helps signficantly but this still gives a 25% slowdown.
  • Disabling region-based GC solves the problem but can only currently be done via an environment variable

Configuration

See links above. Performance testing has only been done on Windows.

Other information

See discussion linked above

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Aug 20, 2022
@ghost
Copy link

ghost commented Aug 20, 2022

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Issue Details

Description

Tracking issue to cover dotnet/fsharp#13730

Since .NET 7 preview 3 the performance of the F# compiler (fsc.dll/fsc.exe) on large inputs has dropped by about 8x (yes, 800% regression). This stems from region-based GC being enabled by default.

Details are above. Particular characteristics are

  • Not Server mode GC
  • Batch mode enabled

Previously .NET Framework and .NET Core GC has performed well with this application

Reproduction Steps

See repro steps in dotnet/fsharp#13730 for the particular case where the compiler is used to compile the F# compiler. We expect the same performance problems on any large inputs to the F# compiler.

Expected behavior

See repro steps in dotnet/fsharp#13730 where you can run the compiler with various version of .NET runtime by adjusting settings. Performance of the F# compiler should match previous versions

Actual behavior

Performance has degraded by about 8x, 200+ second generation GCs where previously there was one.

Regression?

Yes

Known Workarounds

No perfect workarounds.

  • Setting DOTNET_gcServer=1 helps signficantly but this still gives a 25% slowdown.
  • Disabling region-based GC solves the problem but can only currently be done via an environment variable

Configuration

See links above. Performance testing has only been done on Windows.

Other information

See discussion linked above

Author: dsyme
Assignees: -
Labels:

area-GC-coreclr, untriaged

Milestone: -

@mangod9 mangod9 removed the untriaged New issue has not been triaged by the area owner label Aug 20, 2022
@mangod9 mangod9 added this to the 7.0.0 milestone Aug 20, 2022
@mangod9
Copy link
Member

mangod9 commented Aug 20, 2022

we can repro it and are investigating.

@Maoni0 Maoni0 self-assigned this Aug 20, 2022
@Maoni0
Copy link
Member

Maoni0 commented Aug 20, 2022

this is due to the accounting for SIP regions. I will make a fix soon. you should not have this problem with the latest build since SIP isn't on by default.

@dsyme
Copy link
Author

dsyme commented Aug 20, 2022

Thank you Maoni! Will work with @vzarytovskii to validate

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 20, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 22, 2022
@dsyme
Copy link
Author

dsyme commented Aug 22, 2022

Thanks @Maoni0! I'll leave to @vzarytovskii and others to validate

@ghost ghost locked as resolved and limited conversation to collaborators Sep 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants