1
0
Fork 0
forked from lthn/blockchain

improvements over derivation performance test

This commit is contained in:
cryptozoidberg 2019-09-20 19:24:33 +02:00
parent 786614d588
commit c8e6498f53
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
2 changed files with 24 additions and 4 deletions

View file

@ -9,15 +9,35 @@
#include "single_tx_test_base.h"
uint64_t g_antioptimisation = 0;
class test_generate_key_derivation : public single_tx_test_base
{
public:
static const size_t loop_count = 1000;
static const size_t loop_count = 1;
std::list<currency::account_base> accounts;
bool init()
{
for (size_t i = 0; i != 10000; i++)
{
accounts.push_back(currency::account_base());
accounts.back().generate();
}
return single_tx_test_base::init();
}
bool test()
{
crypto::key_derivation recv_derivation;
crypto::generate_key_derivation(m_tx_pub_key, m_bob.get_keys().m_view_secret_key, recv_derivation);
for (auto &a : accounts)
{
crypto::key_derivation recv_derivation = AUTO_VAL_INIT(recv_derivation);
crypto::generate_key_derivation(m_tx_pub_key, a.get_keys().m_view_secret_key, recv_derivation);
g_antioptimisation ^= *(uint64_t*)(&recv_derivation);
}
return true;
}
};

View file

@ -68,7 +68,7 @@ int main(int argc, char** argv)
*/
//TEST_PERFORMANCE0(test_is_out_to_acc);
//TEST_PERFORMANCE0(test_generate_key_image_helper);
//TEST_PERFORMANCE0(test_generate_key_derivation);
TEST_PERFORMANCE0(test_generate_key_derivation);
//TEST_PERFORMANCE0(test_generate_key_image);
//TEST_PERFORMANCE0(test_derive_public_key);
//TEST_PERFORMANCE0(test_derive_secret_key);