Repository navigation
Move AVLSet to Utils project - #24
Merged
Merged
Conversation
gsvgit
reviewed
Nov 9, 2026
gsvgit
left a comment
Member
There was a problem hiding this comment.
I think, optimal Set implementation is an open question (for future). So, let preserve benchmarks for Set (at least for AVL Set).
gsvgit
approved these changes
Nov 13, 2026
The HashSet cases measured the wrong operation after the first invocation. HashSet.UnionWith, IntersectWith and ExceptWith mutate the receiver in place, while AVLSet and F# Set are persistent and return a new set. BenchmarkDotNet runs GlobalSetup once per benchmark case but invokes the benchmark method many times, so by the second iteration: - UnionWith had nothing left to insert, because HashSetA already contained B; - IntersectWith had already shrunk HashSetA to A ∩ B; - ExceptWith had already removed every element of B from HashSetA. The reported timings therefore reflected near no-op or much cheaper operations on an already-mutated set, and were not comparable with the immutable implementations, which always perform the full operation. Clone HashSetA before each mutating operation and return the copy, so every invocation starts from the same input. The clone cost is included in the measurement, matching the allocation that AVLSet and F# Set perform to produce a persistent result. Remove HashSetBenchmark: its Union, Intersection and Difference cases duplicate the HashSet cases in FSSetsBenchmark. Once those cases clone correctly, the separate class only doubles benchmark runtime without adding information. Also remove the unused threads parameter, which belonged to the deleted parallel benchmark, and the ThreadingDiagnoser attribute, since no benchmark performs parallel work anymore.
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.
Also removed ParallelAVLSet with corresponding tests and benchmarks.
@gsvgit, it a good question whether we need benchmarks for AVLSet at all.