Narrated, with original music and captions. The F# loop on the FsStorefront demo, recorded in VS Code: Profile CPU and the heat map on .fs lines, Track Memory, records and union cases painted where they are built, the retention graph rooted at a module value, the fix typed in, then a second run. Fast-forwarded stretches are marked on screen.

Screen recording: profiling an F# app in VS Code with SharpLsp, from hot pipeline stages and closures to F# records and union cases leaking from a module value, and a verified fix

Read the guide: Profiling F#

Transcript

This is FsStorefront, an F# app that's running right now. Let's find out where its time goes.

Stop the profiler, and every hot line of F# lights up: the catalog parsing, the basket shuffle, and the discount fold.

The results keep the names the F# compiler gives your code. Every closure and pipeline stage is named after its line, so you know exactly where to look.

Now let's track memory on the same app. SharpLsp snapshots the heap every ten seconds.

F# records and union cases show up as leak suspects. Click one, and you jump straight to the line that builds it.

So, what's keeping them alive?

A module value called sessions, named just as you wrote it. It holds every session the app has ever seen.

The fix: keep the last thousand sessions, and let the rest go.

Rebuild, run it again, and track memory.

This time the heap holds steady, and nothing climbs past Low. That's F# profiling in SharpLsp. Free, and open source.