mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
pow-testgiver support
This commit is contained in:
parent
dbde9c1c40
commit
f064b1047a
257 changed files with 6665 additions and 2608 deletions
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
#include "td/utils/benchmark.h"
|
||||
#include "td/utils/ConcurrentHashTable.h"
|
||||
#include "td/utils/misc.h"
|
||||
#include "td/utils/port/thread.h"
|
||||
#include "td/utils/SpinLock.h"
|
||||
#include "td/utils/tests.h"
|
||||
|
@ -198,17 +199,17 @@ class HashMapBenchmark : public td::Benchmark {
|
|||
|
||||
size_t threads_n = 16;
|
||||
int mod_;
|
||||
static constexpr size_t mul_ = 7273; //1000000000 + 7;
|
||||
static constexpr size_t MUL = 7273; //1000000000 + 7;
|
||||
int n_;
|
||||
|
||||
public:
|
||||
explicit HashMapBenchmark(size_t threads_n) : threads_n(threads_n) {
|
||||
}
|
||||
std::string get_description() const override {
|
||||
return hash_map->get_name();
|
||||
return HashMap::get_name();
|
||||
}
|
||||
void start_up_n(int n) override {
|
||||
n *= (int)threads_n;
|
||||
n *= static_cast<int>(threads_n);
|
||||
n_ = n;
|
||||
hash_map = td::make_unique<HashMap>(n * 2);
|
||||
}
|
||||
|
@ -222,8 +223,8 @@ class HashMapBenchmark : public td::Benchmark {
|
|||
size_t r = n * (i + 1) / threads_n;
|
||||
threads.emplace_back([l, r, this] {
|
||||
for (size_t i = l; i < r; i++) {
|
||||
auto x = int((i + 1) * mul_ % n_) + 3;
|
||||
auto y = int(i + 2);
|
||||
auto x = td::narrow_cast<int>((i + 1) * MUL % n_) + 3;
|
||||
auto y = td::narrow_cast<int>(i + 2);
|
||||
hash_map->insert(x, y);
|
||||
}
|
||||
});
|
||||
|
@ -235,8 +236,8 @@ class HashMapBenchmark : public td::Benchmark {
|
|||
|
||||
void tear_down() override {
|
||||
for (int i = 0; i < n_; i++) {
|
||||
auto x = int((i + 1) * mul_ % n_) + 3;
|
||||
auto y = int(i + 2);
|
||||
auto x = td::narrow_cast<int>((i + 1) * MUL % n_) + 3;
|
||||
auto y = td::narrow_cast<int>(i + 2);
|
||||
ASSERT_EQ(y, hash_map->find(x, -1));
|
||||
}
|
||||
queries.clear();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue