Commit 0a53f56
perf(bench): pre-size the HashSet baseline in SparseSetBenchmark Add for a fair comparison
SparseSet's universe is mandatory, so `new SparseSet(universe)` inherently
pre-allocates its sparse array and pays no sparse resize on Add, whereas the
`new HashSet<int>()` baseline paid full incremental-rehash growth — an unfair
per-add comparison. Give the baseline the matching capacity hint
(`new HashSet<int>(ItemCount)`, as the Setup / Remove paths already do) so the
Add category measures per-add cost rather than the baseline's rehash overhead.
Addresses a Copilot review comment on PR #288.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent f6a68a6 commit 0a53f56
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
| |||
0 commit comments