Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark application #4101

Merged
merged 6 commits into from
Oct 11, 2024
Merged

Benchmark application #4101

merged 6 commits into from
Oct 11, 2024

Conversation

onvej-sl
Copy link
Contributor

@onvej-sl onvej-sl commented Aug 13, 2024

This pull request implements an application that benchmarks various cryptographic primitives.

The application is hidden behind a compilation flag:
BENCHMARK=1 make -C core build_firmware

Using trezorctl, you can:

  • List all benchmarks or only the benchmarks matching a given pattern:
$ trezorctl benchmark list-names
crypto/cipher/aes128-ecb/decrypt
crypto/cipher/aes128-ecb/encrypt
crypto/cipher/chacha20poly1305/decrypt
crypto/cipher/chacha20poly1305/encrypt
crypto/curve/curve25519/multiply
crypto/curve/curve25519/publickey
crypto/curve/ed25519/publickey
crypto/curve/ed25519/sign
crypto/curve/ed25519/verify
crypto/curve/nist256p1/multiply
crypto/curve/nist256p1/publickey
crypto/curve/nist256p1/sign
crypto/curve/nist256p1/verify
crypto/curve/secp256k1/multiply
crypto/curve/secp256k1/publickey
crypto/curve/secp256k1/sign
crypto/curve/secp256k1/verify
crypto/hash/blake256
crypto/hash/blake2b
crypto/hash/blake2s
crypto/hash/groestl512
crypto/hash/ripemd160
crypto/hash/sha1
crypto/hash/sha256
crypto/hash/sha3_256
crypto/hash/sha3_512
crypto/hash/sha512
$ trezorctl benchmark list-names "crypto/curve/*/sign"
crypto/curve/ed25519/sign
crypto/curve/nist256p1/sign
crypto/curve/secp256k1/sign
  • Run all benchmarks or only the benchmarks matching a given pattern:
$ trezorctl benchmark run
crypto/cipher/aes128-ecb/decrypt: 0.96 MB/s
crypto/cipher/aes128-ecb/encrypt: 0.98 MB/s
crypto/cipher/aesgcm128/decrypt: 0.31 MB/s
crypto/cipher/aesgcm128/encrypt: 0.30 MB/s
crypto/cipher/aesgcm256/decrypt: 0.29 MB/s
crypto/cipher/aesgcm256/encrypt: 0.29 MB/s
crypto/cipher/chacha20poly1305/decrypt: 2.1 MB/s
crypto/cipher/chacha20poly1305/encrypt: 2.1 MB/s
crypto/curve/curve25519/multiply: 8.8 ms
crypto/curve/curve25519/publickey: 3.9 ms
crypto/curve/ed25519/publickey: 4.1 ms
crypto/curve/ed25519/sign: 8.3 ms
crypto/curve/ed25519/verify: 11 ms
crypto/curve/nist256p1/multiply: 110 ms
crypto/curve/nist256p1/publickey: 23 ms
crypto/curve/nist256p1/sign: 27 ms
crypto/curve/nist256p1/verify: 130 ms
crypto/curve/secp256k1/multiply: 110 ms
crypto/curve/secp256k1/publickey: 17 ms
crypto/curve/secp256k1/sign: 17 ms
crypto/curve/secp256k1/verify: 8.2 ms
crypto/hash/blake256: 1.5 MB/s
crypto/hash/blake2b: 2.3 MB/s
crypto/hash/blake2s: 3.1 MB/s
crypto/hash/groestl512: 0.16 MB/s
crypto/hash/ripemd160: 5.5 MB/s
crypto/hash/sha1: 2.7 MB/s
crypto/hash/sha256: 1.9 MB/s
crypto/hash/sha3_256: 0.63 MB/s
crypto/hash/sha3_512: 0.33 MB/s
crypto/hash/sha512: 1.1 MB/s

@onvej-sl onvej-sl marked this pull request as ready for review August 19, 2024 12:18
@onvej-sl onvej-sl removed the request for review from prusnak August 19, 2024 12:19
core/src/apps/benchmark/__init__.py Outdated Show resolved Hide resolved
common/protob/messages.proto Outdated Show resolved Hide resolved
core/src/apps/workflow_handlers.py Show resolved Hide resolved
@@ -280,25 +281,26 @@ build_firmware: templates build_cross ## build firmware with frozen modules
PYOPT="$(PYOPT)" BITCOIN_ONLY="$(BITCOIN_ONLY)" \
BOOTLOADER_QA="$(BOOTLOADER_QA)" BOOTLOADER_DEVEL="$(BOOTLOADER_DEVEL)" \
DISABLE_OPTIGA="$(DISABLE_OPTIGA)" THP="$(THP)" NEW_RENDERING="$(NEW_RENDERING)" \
$(FIRMWARE_BUILD_DIR)/firmware.bin
BENCHMARK="$(BENCHMARK)" $(FIRMWARE_BUILD_DIR)/firmware.bin
Copy link
Contributor

@matejcik matejcik Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that there's now a common section SCONS_OPTS where this will go when you're rebasing oh it's not here yet, it's in #4234. not sure when that will land so you can either go ahead here or wait for it

@onvej-sl onvej-sl force-pushed the onvej-sl/benchmark branch 3 times, most recently from 2fd91e3 to db808b3 Compare October 10, 2024 12:48
@onvej-sl onvej-sl merged commit 2d5d720 into main Oct 11, 2024
85 checks passed
@onvej-sl onvej-sl deleted the onvej-sl/benchmark branch October 11, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Approved
Development

Successfully merging this pull request may close these issues.

3 participants