Skip to content

Move AVLSet to Utils project - #24

Merged
gsvgit merged 6 commits into
graph-projectfrom
utils
Nov 16, 2026
Merged

gsvgit merged 6 commits into
graph-projectfrom
utils

Conversation

@WoWaster

@WoWaster WoWaster commented Nov 6, 2026

Copy link
Copy Markdown
Member

Also removed ParallelAVLSet with corresponding tests and benchmarks.

@gsvgit, it a good question whether we need benchmarks for AVLSet at all.

@WoWaster
WoWaster requested a review from gsvgit November 6, 2026 22:31
@WoWaster
WoWaster added this pull request to stack #23 November 6, 2026 22:31

@gsvgit gsvgit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, optimal Set implementation is an open question (for future). So, let preserve benchmarks for Set (at least for AVL Set).

Comment thread AGENTS.md Resolved
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.
@gsvgit
gsvgit merged commit 3818eb8 into main Nov 16, 2026
2 checks passed
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.

2 participants