Repository navigation
reduce memory allocations in Requirements.simplify - #4314
Merged
Merged
Conversation
chinwobble
marked this pull request as ready for review
January 17, 2026 06:22
chinwobble
commented
Jan 17, 2026
| member x.RepresentedFrameworks = | ||
| match x with | ||
| | FrameworkRestrictionP.ExactlyP r -> [ r ] |> Set.ofList | ||
| | FrameworkRestrictionP.ExactlyP r -> Set.singleton r |
Contributor
Author
There was a problem hiding this comment.
this line reduces allocations by 72 bytes per operation.
chinwobble
commented
Jan 17, 2026
| | [single] -> single.RepresentedFrameworks | ||
| | h :: rest -> | ||
| // Use fold to avoid Seq.map allocation | ||
| List.fold (fun (acc : Set<TargetProfile>) (fr : FrameworkRestrictionP) -> |
Contributor
Author
There was a problem hiding this comment.
using fold instead of list.Map reduce allocations by 104 bytes per operation
Member
|
thanks! |
This was referenced Jan 20, 2026
This was referenced Jan 27, 2026
This was referenced Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context:
I am converting a project from nuget to paket and there are many conflicts. I noticed that the
dotnet paket installcommand can take several minutes just to tell me there is a conflict and paket cannot generate a lock file.I have used https://github.com/microsoft/perfview to find where the bottlenecks.
I have identified a few bottlenecks:
I have run perf view with the following settings
Equivalent to the below settings:
Using the tool
GC Heap Alloc Ignore Free tooland setting include pattern to be:By default events are captured machine wide, we are only interested in memory allocation events that from stack traces within the
paketprocess' main method.perfviewcaptures diagnostic system wide.Drilling into the call tree shows that
Requirements.Simplify'allocates 13% of the memory of the lifetime ofpaket install. I use the.NET SampAllocwhich samples allocations as I ran out of disk space running with.NET Alloc CheckBox. It consumed 70 GB+.GC Stats
After collecting the trace before and after the code change the stats have changed accordingly: