Skip to content

Commit

Permalink
add benchmarking script
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias J. Kannwischer <[email protected]>
  • Loading branch information
mkannwischer committed Jun 19, 2024
1 parent 5cfee23 commit c0fc880
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
21 changes: 21 additions & 0 deletions scripts/tests
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def base_run(bin, force_qemu, verbose):
capture_output=True,
universal_newlines=False,
)
if verbose:
print(result.stdout.decode())

return result.stdout

Expand Down Expand Up @@ -254,6 +256,24 @@ def kat(force_qemu, verbose):
)


@click.command(
short_help="Run the benchmarks for all parameter sets",
context_settings={"show_default": True},
)
@add_options(_shared_options)
def bench(force_qemu, verbose):
config_logger(verbose)

test_schemes(
"benchmark",
lambda scheme: scheme.name.replace("MLKEM", "test/bin/bench_kyber"),
lambda _: True,
lambda _: True,
force_qemu,
verbose,
)


@click.group(invoke_without_command=True)
def cli():
pass
Expand All @@ -263,6 +283,7 @@ cli.add_command(run)
cli.add_command(func)
cli.add_command(nistkat)
cli.add_command(kat)
cli.add_command(bench)

if __name__ == "__main__":
cli()
6 changes: 3 additions & 3 deletions test/bench_kyber.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
#include "hal.h"
#include "randombytes.h"

#define NWARMUP 10
#define NITERERATIONS 100
#define NTESTS 100
#define NWARMUP 50
#define NITERERATIONS 300
#define NTESTS 200

static int cmp_uint64_t(const void *a, const void *b)
{
Expand Down

0 comments on commit c0fc880

Please sign in to comment.