mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 14:53:43 +01:00
Use steady clock in SeedStrengthen and FindBestImplementation
This commit is contained in:
@@ -23,17 +23,17 @@ static constexpr uint32_t BITS = 32;
|
||||
|
||||
uint32_t FindBestImplementation()
|
||||
{
|
||||
std::optional<std::pair<int64_t, uint32_t>> best;
|
||||
std::optional<std::pair<SteadyClock::duration, uint32_t>> best;
|
||||
|
||||
uint32_t max_impl = Minisketch::MaxImplementation();
|
||||
for (uint32_t impl = 0; impl <= max_impl; ++impl) {
|
||||
std::vector<int64_t> benches;
|
||||
std::vector<SteadyClock::duration> benches;
|
||||
uint64_t offset = 0;
|
||||
/* Run a little benchmark with capacity 32, adding 184 entries, and decoding 11 of them once. */
|
||||
for (int b = 0; b < 11; ++b) {
|
||||
if (!Minisketch::ImplementationSupported(BITS, impl)) break;
|
||||
Minisketch sketch(BITS, impl, 32);
|
||||
auto start = GetTimeMicros();
|
||||
auto start = SteadyClock::now();
|
||||
for (uint64_t e = 0; e < 100; ++e) {
|
||||
sketch.Add(e*1337 + b*13337 + offset);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ uint32_t FindBestImplementation()
|
||||
sketch.Add(e*1337 + b*13337 + offset);
|
||||
}
|
||||
offset += (*sketch.Decode(32))[0];
|
||||
auto stop = GetTimeMicros();
|
||||
auto stop = SteadyClock::now();
|
||||
benches.push_back(stop - start);
|
||||
}
|
||||
/* Remember which implementation has the best median benchmark time. */
|
||||
|
||||
Reference in New Issue
Block a user