mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 18:41:08 +01:00
Collect more detailed metrics on hashtables. (#4046)
Previously we just looked at the raw count of probed keys. Now, we compute the average and max of both the probe _distance_ measured in the number of _groups_ probed, and the number of probe _compares_ measured in the compares required _before_ finding the matching entry. This lets us understand the relative impact of probe-distance vs. tag collisions on a given set of benchmark keys. Some of this is motivated by considering additional optimization techniques similar to those used in Boost's table and the F14 table from Facebook/Meta. --------- Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Richard Smith
parent
21a81bc59e
commit
3be57b71e0
@@ -16,6 +16,7 @@ using RawHashtable::CarbonHashDI;
|
||||
using RawHashtable::GetKeysAndHitKeys;
|
||||
using RawHashtable::GetKeysAndMissKeys;
|
||||
using RawHashtable::HitArgs;
|
||||
using RawHashtable::ReportTableMetrics;
|
||||
using RawHashtable::SizeArgs;
|
||||
using RawHashtable::ValueToBool;
|
||||
|
||||
@@ -362,13 +363,7 @@ static void BM_SetInsertSeq(benchmark::State& state) {
|
||||
CARBON_DCHECK(inserted) << "Must be a successful insert!";
|
||||
}
|
||||
|
||||
// While this count is "iteration invariant" (it should be exactly the same
|
||||
// for every iteration as the set of keys is the same), we don't use that
|
||||
// because it will scale this by the number of iterations. We want to
|
||||
// display the probe count of this benchmark *parameter*, not the probe
|
||||
// count that resulted from the number of iterations. That means we use the
|
||||
// normal counter API without flags.
|
||||
state.counters["Probed"] = s.CountProbedKeys();
|
||||
ReportTableMetrics(s, state);
|
||||
|
||||
// Uncomment this call to print out statistics about the index-collisions
|
||||
// among these keys for debugging:
|
||||
|
||||
Reference in New Issue
Block a user