Skip to content

Commit 994b36e

Browse files
OnurGumusclaude
andcommitted
Add troubleshooting section for F# 10 high CPU workaround
Document the FSharp_CacheEvictionImmediate=1 env var workaround for the FCS type subsumption cache hashing bug (dotnet/fsharp#19369). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c5749bb commit 994b36e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,23 @@ type T = HtmlTypeProvider.Template<
118118
>
119119
```
120120

121+
## Troubleshooting
122+
123+
### High CPU usage in IDE with .NET 10 / F# 10
124+
125+
If you experience sustained high CPU from `fsautocomplete` (the F# language server) when using this provider with F# 10, it is caused by an [FCS bug](https://github.com/dotnet/fsharp/pull/19369) in the type subsumption cache where `TypeStructure.GetHashCode` performs O(n) hashing on every cache lookup.
126+
127+
**Workaround:** Set the environment variable `FSharp_CacheEvictionImmediate=1` before launching your editor. This switches the cache eviction strategy from a background worker (which continuously rehashes) to synchronous inline eviction, eliminating the CPU spike while keeping the cache functional.
128+
129+
On macOS (persists until reboot):
130+
```bash
131+
launchctl setenv FSharp_CacheEvictionImmediate 1
132+
```
133+
134+
On Linux/Windows, set the variable in your shell profile or system environment variables.
135+
136+
After setting it, fully restart your editor (not just reload).
137+
121138
## Safety
122139

123140
- All text content holes are HTML-encoded via `System.Net.WebUtility.HtmlEncode`

0 commit comments

Comments
 (0)