File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
llvm/include/llvm/ProfileData Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -1303,9 +1303,12 @@ raw_ostream &operator<<(raw_ostream &OS, const FunctionSamples &FS);
1303
1303
// / collision is silently ignored). Given such feature this class should only be
1304
1304
// / used where it does not affect compilation correctness, for example, when
1305
1305
// / 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:
1308
1310
// / 1 - (2^64)!/((2^64-1000000)!*(2^64)^1000000) ~= 3*10^-8.
1311
+ // / Source: https://en.wikipedia.org/wiki/Birthday_problem
1309
1312
template <template <typename , typename , typename ...> typename MapT,
1310
1313
typename KeyT, typename ValueT, typename ... MapTArgs>
1311
1314
class HashKeyMap : public MapT <hash_code, ValueT, MapTArgs...> {
You can’t perform that action at this time.
0 commit comments