better perf testing fot check_hash

This commit is contained in:
jeffro256 2024-02-16 12:20:37 -06:00
parent b402d57e93
commit 46da5d7943
No known key found for this signature in database
GPG Key ID: 6F79797A6E392442
2 changed files with 28 additions and 10 deletions

View File

@ -32,11 +32,12 @@
#include "int-util.h"
#include "cryptonote_basic/difficulty.h"
template<uint64_t hash_target_high, uint64_t hash_target_low, uint64_t difficulty_high, uint64_t difficulty_low>
template<uint64_t hash_target_high, uint64_t hash_target_low, uint64_t difficulty_high, uint64_t difficulty_low, bool FORCE_128>
class test_check_hash
{
public:
static const size_t loop_count = 100000;
static const size_t loop_count = 2;
static const size_t inner_loop_count = 300000;
bool init()
{
@ -62,7 +63,17 @@ public:
bool test()
{
cryptonote::check_hash_128(hash, difficulty);
for (size_t j = 0; j < inner_loop_count; ++j)
{
if constexpr (FORCE_128)
{
cryptonote::check_hash_128(hash, difficulty);
}
else
{
cryptonote::check_hash(hash, difficulty);
}
}
return true;
}

View File

@ -188,13 +188,20 @@ int main(int argc, char** argv)
TEST_PERFORMANCE4(filter, p, test_check_tx_signature_aggregated_bulletproofs, 2, 2, 56, 16);
TEST_PERFORMANCE4(filter, p, test_check_tx_signature_aggregated_bulletproofs, 10, 2, 56, 16);
TEST_PERFORMANCE4(filter, p, test_check_hash, 0, 1, 0, 1);
TEST_PERFORMANCE4(filter, p, test_check_hash, 0, 0xffffffffffffffff, 0, 0xffffffffffffffff);
TEST_PERFORMANCE4(filter, p, test_check_hash, 0, 0xffffffffffffffff, 0, 1);
TEST_PERFORMANCE4(filter, p, test_check_hash, 1, 0, 1, 0);
TEST_PERFORMANCE4(filter, p, test_check_hash, 1, 0, 0, 1);
TEST_PERFORMANCE4(filter, p, test_check_hash, 0xffffffffffffffff, 0xffffffffffffffff, 0, 1);
TEST_PERFORMANCE4(filter, p, test_check_hash, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff);
TEST_PERFORMANCE5(filter, p, test_check_hash, 0, 1, 0, 1, true);
TEST_PERFORMANCE5(filter, p, test_check_hash, 0, 0xffffffffffffffff, 0, 0xffffffffffffffff, true);
TEST_PERFORMANCE5(filter, p, test_check_hash, 0, 0xffffffffffffffff, 0, 1, true);
TEST_PERFORMANCE5(filter, p, test_check_hash, 1, 0, 1, 0, true);
TEST_PERFORMANCE5(filter, p, test_check_hash, 1, 0, 0, 1, true);
TEST_PERFORMANCE5(filter, p, test_check_hash, 0xffffffffffffffff, 0xffffffffffffffff, 0, 1, true);
TEST_PERFORMANCE5(filter, p, test_check_hash, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, true);
TEST_PERFORMANCE5(filter, p, test_check_hash, 0, 1, 0, 1, false);
TEST_PERFORMANCE5(filter, p, test_check_hash, 0, 0xffffffffffffffff, 0, 0xffffffffffffffff, false);
TEST_PERFORMANCE5(filter, p, test_check_hash, 0, 0xffffffffffffffff, 0, 1, false);
TEST_PERFORMANCE5(filter, p, test_check_hash, 1, 0, 1, 0, false);
TEST_PERFORMANCE5(filter, p, test_check_hash, 1, 0, 0, 1, false);
TEST_PERFORMANCE5(filter, p, test_check_hash, 0xffffffffffffffff, 0xffffffffffffffff, 0, 1, false);
TEST_PERFORMANCE5(filter, p, test_check_hash, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, false);
TEST_PERFORMANCE0(filter, p, test_is_out_to_acc);
TEST_PERFORMANCE0(filter, p, test_is_out_to_acc_precomp);