Skip to content

Commit 9cc24d2

Browse files
committed
If users force HashSet, try perfect hashset
1 parent 81b64ca commit 9cc24d2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Src/FastData/FastDataGenerator.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ private static IEnumerable<IStructure<T>> GetDataStructureCandidates<T>(T[] data
151151
else if (ds == StructureType.BinarySearch)
152152
yield return new BinarySearchStructure<T>(props.DataType, DefaultStringComparison);
153153
else if (ds == StructureType.HashSet)
154-
yield return new HashSetChainStructure<T>(HashData.Create(data, props.DataType, config.HashCapacityFactor));
154+
{
155+
HashData hashData = HashData.Create(data, props.DataType, config.HashCapacityFactor);
156+
157+
if (hashData.HashCodesPerfect)
158+
yield return new HashSetPerfectStructure<T>(hashData);
159+
160+
yield return new HashSetChainStructure<T>(hashData);
161+
}
155162
else
156163
throw new InvalidOperationException($"Unsupported DataStructure {ds}");
157164
}

0 commit comments

Comments
 (0)