When initializing a HashSet like this:
new HashSet<string>(80_000_000);
the underlying arrays (buckets and slots) will not have the size of ~80M (its next prime number) but the size of the next prime number in the pre-computed list, which is 92_434_613. This is an oversize of 11.55% and is not expected by the user. The worst case is that the array gets oversized by 20% because of the layout of the pre-computed prime numbers.
This was introduced by dotnet/corefx#6203
cc @jkotas @stephentoub @danmosemsft
When initializing a HashSet like this:
the underlying arrays (buckets and slots) will not have the size of ~80M (its next prime number) but the size of the next prime number in the pre-computed list, which is 92_434_613. This is an oversize of 11.55% and is not expected by the user. The worst case is that the array gets oversized by 20% because of the layout of the pre-computed prime numbers.
This was introduced by dotnet/corefx#6203
cc @jkotas @stephentoub @danmosemsft