Skip to content

Huge performance drop for fsc.exe/dll #74286

@dsyme

Description

@dsyme

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions