Skip to content

Commit 70fd123

Browse files
committed
Updated comments
1 parent b6bfc61 commit 70fd123

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/include/llvm/ProfileData/SampleProf.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,9 +1303,12 @@ raw_ostream &operator<<(raw_ostream &OS, const FunctionSamples &FS);
13031303
/// collision is silently ignored). Given such feature this class should only be
13041304
/// used where it does not affect compilation correctness, for example, when
13051305
/// loading a sample profile.
1306-
/// Assuming the hashing algorithm is uniform, the probability of hash collision
1307-
/// with 1,000,000 entries is
1306+
/// Assuming the hashing algorithm is uniform, we use the formula
1307+
/// 1 - Permute(n, k) / n ^ k where n is the universe size and k is number of
1308+
/// elements chosen at random to calculate the probability of collision. With
1309+
/// 1,000,000 entries the probability is negligible:
13081310
/// 1 - (2^64)!/((2^64-1000000)!*(2^64)^1000000) ~= 3*10^-8.
1311+
/// Source: https://en.wikipedia.org/wiki/Birthday_problem
13091312
template <template <typename, typename, typename...> typename MapT,
13101313
typename KeyT, typename ValueT, typename... MapTArgs>
13111314
class HashKeyMap : public MapT<hash_code, ValueT, MapTArgs...> {

0 commit comments

Comments
 (0)