Skip to content

Conversation

@nazar-pc
Copy link
Owner

This implements optimized implementation of PoT proving and verification on aarch64.

Before (Raspberry PI 5):

verify                  time:   [1.1665 s 1.1817 s 1.1976 s]

After:

verify                  time:   [835.30 ms 835.30 ms 835.31 ms]

I'm not sure why runtime detection is so expensive in aes crate (RustCrypto/block-ciphers#484), but we certainly avoid doing the check on each iteration by implementing an efficient implementation + saving some on extra XORs. When compiled with RUSTFLAGS="-C target-feature=+aes" aes crate improves, but not quite to the same level as optimized implementation, so this is a substantial win either way for generic aarch64 platforms (not sure about the impact on macOS, I think +aes is implied there by default):

verify                  time:   [866.87 ms 884.87 ms 902.90 ms]

Moreover, runtime feature detection now happens once per 200M iterations instead of on each iteration, massively decreasing its cost.

Proving is not expected to be used on aarch64, but for those who do it will be faster now too.

@nazar-pc nazar-pc force-pushed the aarch64-pot branch 3 times, most recently from 5ee7b83 to 40e1095 Compare May 31, 2025 07:44
@nazar-pc nazar-pc enabled auto-merge May 31, 2025 07:45
@nazar-pc nazar-pc changed the title Implement PoT proving and verification optimized for AES+NEON Implement PoT proving and verification optimized for AES (aarch64) May 31, 2025
@nazar-pc nazar-pc disabled auto-merge May 31, 2025 07:48
@nazar-pc nazar-pc enabled auto-merge May 31, 2025 07:48
@nazar-pc nazar-pc merged commit f99ac6e into main May 31, 2025
18 checks passed
@nazar-pc nazar-pc deleted the aarch64-pot branch May 31, 2025 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant