mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 15:39:07 +00:00
Add bench for rejection sampling
This commit is contained in:
parent
40e3fff409
commit
128b5406cc
@ -10,6 +10,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#include "kem/kyber/kyber512/avx2/indcpa.h"
|
#include "kem/kyber/kyber512/avx2/indcpa.h"
|
||||||
#include "kem/kyber/kyber512/avx2/kem.h"
|
#include "kem/kyber/kyber512/avx2/kem.h"
|
||||||
|
#include "kem/kyber/kyber512/avx2/rejsample.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
auto cpucycle = [](benchmark::State &st, int64_t cycles) {
|
auto cpucycle = [](benchmark::State &st, int64_t cycles) {
|
||||||
@ -30,6 +31,19 @@ static void BenchKyberMatK2(benchmark::State &st) {
|
|||||||
cpucycle(st, total);
|
cpucycle(st, total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void BenchKyberRejSampling(benchmark::State &st) {
|
||||||
|
int64_t t, total = 0;
|
||||||
|
int16_t a[256];
|
||||||
|
uint8_t seed[168*3];
|
||||||
|
for (auto _ : st) {
|
||||||
|
t = benchmark::cycleclock::Now();
|
||||||
|
PQCLEAN_KYBER512_AVX2_rej_uniform_avx(a, seed);
|
||||||
|
total += benchmark::cycleclock::Now() - t;
|
||||||
|
benchmark::DoNotOptimize(a);
|
||||||
|
}
|
||||||
|
cpucycle(st, total);
|
||||||
|
}
|
||||||
|
|
||||||
static void BenchKyberKeygen(benchmark::State &st) {
|
static void BenchKyberKeygen(benchmark::State &st) {
|
||||||
int64_t t, total = 0;
|
int64_t t, total = 0;
|
||||||
uint8_t sk[1632];
|
uint8_t sk[1632];
|
||||||
@ -77,6 +91,7 @@ static void BenchKyberDecaps(benchmark::State &st) {
|
|||||||
cpucycle(st, total);
|
cpucycle(st, total);
|
||||||
}
|
}
|
||||||
BENCHMARK(BenchKyberMatK2);
|
BENCHMARK(BenchKyberMatK2);
|
||||||
|
BENCHMARK(BenchKyberRejSampling);
|
||||||
BENCHMARK(BenchKyberKeygen);
|
BENCHMARK(BenchKyberKeygen);
|
||||||
BENCHMARK(BenchKyberEncaps);
|
BENCHMARK(BenchKyberEncaps);
|
||||||
BENCHMARK(BenchKyberDecaps);
|
BENCHMARK(BenchKyberDecaps);
|
||||||
|
Loading…
Reference in New Issue
Block a user