Pippenger multiexp

Based on sarang's python code
This commit is contained in:
moneromooo-monero 2018-05-28 00:27:54 +01:00
parent 1ed0ed4de4
commit 263431c486
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
5 changed files with 284 additions and 4 deletions

View file

@ -222,26 +222,168 @@ int main(int argc, char** argv)
TEST_PERFORMANCE1(filter, verbose, test_crypto_ops, op_addKeys3_2);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 2);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 4);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 8);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 16);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 32);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 64);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 128);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 256);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 512);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 1024);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 2048);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_bos_coster, 4096);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 2);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 4);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 8);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 16);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 32);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 64);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 128);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 256);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 512);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 1024);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 2048);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus, 4096);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 2);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 4);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 8);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 16);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 32);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 64);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 128);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 256);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 512);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 1024);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 2048);
TEST_PERFORMANCE2(filter, verbose, test_multiexp, multiexp_straus_cached, 4096);
#if 1
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 8, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 16, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 32, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 64, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 128, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 256, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 512, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 1024, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2048, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4096, 9);
#else
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 8, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 8, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 8, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 8, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 8, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 8, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 8, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 8, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 8, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 16, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 16, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 16, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 16, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 16, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 16, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 16, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 16, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 16, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 32, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 32, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 32, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 32, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 32, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 32, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 32, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 32, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 32, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 64, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 64, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 64, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 64, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 64, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 64, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 64, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 64, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 64, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 128, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 128, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 128, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 128, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 128, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 128, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 128, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 128, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 128, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 256, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 256, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 256, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 256, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 256, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 256, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 256, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 256, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 256, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 512, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 512, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 512, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 512, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 512, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 512, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 512, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 512, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 512, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 1024, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 1024, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 1024, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 1024, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 1024, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 1024, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 1024, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 1024, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 1024, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2048, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2048, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2048, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2048, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2048, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2048, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2048, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2048, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 2048, 9);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4096, 1);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4096, 2);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4096, 3);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4096, 4);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4096, 5);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4096, 6);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4096, 7);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4096, 8);
TEST_PERFORMANCE3(filter, verbose, test_multiexp, multiexp_pippenger, 4096, 9);
#endif
std::cout << "Tests finished. Elapsed time: " << timer.elapsed_ms() / 1000 << " sec" << std::endl;
return 0;

View file

@ -39,9 +39,10 @@ enum test_multiexp_algorithm
multiexp_bos_coster,
multiexp_straus,
multiexp_straus_cached,
multiexp_pippenger,
};
template<test_multiexp_algorithm algorithm, size_t npoints>
template<test_multiexp_algorithm algorithm, size_t npoints, size_t c=0>
class test_multiexp
{
public:
@ -74,6 +75,8 @@ public:
return res == straus(data);
case multiexp_straus_cached:
return res == straus(data, cache);
case multiexp_pippenger:
return res == pippenger(data, c);
default:
return false;
}