Skip to content

Conversation

Numpsy
Copy link
Contributor

@Numpsy Numpsy commented Aug 17, 2025

Just a thought I had after running a run of FSharpLint over one of my projects thought the Visual Studio memory profiler. It's quite trivial in the overall schema of things, but in case anyone is interested.

I noticed that charListToString was creating quite a large number of strings:

Screenshot 2025-08-10 224138

And I wondered if String.Create could be used to reduce the number of temporary strings. Doing so got

Screenshot 2025-08-11 005042

The actual amounts of memory here are rather small compared to total memory because the strings are tine -

Before

| Method      | Mean    | Error    | StdDev   | Gen0        | Gen1       | Gen2      | Allocated  |
|------------ |--------:|---------:|---------:|------------:|-----------:|----------:|-----------:|
| LintProject | 3.983 s | 0.1033 s | 0.2964 s | 167000.0000 | 22000.0000 | 1000.0000 | 1008.65 MB |

After

| Method      | Mean    | Error    | StdDev   | Gen0        | Gen1       | Gen2      | Allocated  |
|------------ |--------:|---------:|---------:|------------:|-----------:|----------:|-----------:|
| LintProject | 3.916 s | 0.1088 s | 0.3088 s | 167000.0000 | 22000.0000 | 1000.0000 | 1007.31 MB |

But the change is also small so maybe it's still useful.

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