About zkalc
Cryptographers tend to be good at cryptography but they can be quite bad at estimating the time it takes a computer to run their schemes.
zkalc helps you calculate how much time cryptographic operations take on a real computer
zkalc was created to instantly answer questions like "How quickly can I run an MSM of size and compute pairings on an AWS C5 machine?" or "Which curve can perform DH in less than microseconds?".
We hope that zkalc can help shorten the gap between cryptography and practice:
- Cryptographers can use the simple UX to learn how fast their new fancy scheme runs on various machines without wasting computer cycles and CO2;
- Protocol designers can easily tune the parameters of their protocol depending on their requirements
We designed zkalc to be easy to use but also easy to extend. Writing new types of benchmarks, or adding fresh data to the zkalc website is easy. We hope that this way we can motivate you to improve zkalc to better fit your needs. See below for more details.
zkalc tips
Here are some ways you can squeeze more juice out of zkalc:
- Hover over operations to get more details about them
- Hover over a machine or a library to get more details about the benchmark setup
- Click on the title to reset zkalc
- Click on the total time to get the result in SI units (seconds)
- Type over the dropdown select menu to autocomplete the cryptographic operation
- Type inside the quantity box any arithmetic operation, even common constants like
e
andpi
or functions likelog2
Enriching zkalc
zkalc does not currently support all possible cryptographic operations. For example, we do not currently have benchmarks for FFTs, or batch inversion formulae.
If a functionality you need is missing, please help us add it! First, make sure you check out our methodology page and then follow the instructions below:
- Find the existing benchmarks in the
backend/
directory, and add benchmark code for the new cryptographic operation following the already existing conventions. - Run all benchmarks on your machine by running
make
in thebackend/
directory.
Last but not least please open a PR with your changes and the json benchmark output files and we will take care of the rest!
In the sections below, we provide more information on how to mod zkalc:
Benchmarking on another machine
zkalc only supports a few machine types right now. Do you have access to a beefy AWS machine or to some GPU prover? We would love to get in touch!
Simply run all benchmarks on your beefy AWS machine by running make
in the
backend/
directory. Then open a PR with the json benchmark output files and we
will take care of the rest!
If your machine is especially weak (rpi4) or particularly strong (GPU prover) consider modifying the benchmark parameters (e.g. increase/decrease the size of the MSMs) and get in touch with us!
Testing new curves and libraries
To add benchmarks for a different elliptic curve, write benchmarks for the new
curve in the backend/
directory following the
already existing conventions.
Note that if your benchmarks do not use the
criterion benchmark framework you
will need to adapt your benchmark framework to output a JSON file that the zkalc
interpolation script understands (it currently
understands a small subset
of the
format
of criterion's estimates.json
). If you are confused, get in touch and we will
help.
Finally, please open a PR with your changes and the json benchmark output files and we will take care of the rest!