nymtech / nym

Nym provides strong network-level privacy against sophisticated end-to-end attackers, and anonymous transactions using blinded, re-randomizable, decentralized credentials.
https://nymtech.net
1.26k stars 231 forks source link

Benchmark lib25519 using processor cycles #2996

Open futurechimp opened 1 year ago

futurechimp commented 1 year ago

We've had some advice from DJB that we might be able to get a significant speedup in mix packet cryptography if we switch to using lib25519.

The first step in speeding anything up is to first measure the baseline (in our case, ed25519-dalek). He suggests that we should do cryptographic benchmarking using processor cycles, rather than time, in our benchmarks.

We'll need to

(a) figure out how to do that. The standard Rust benchmarks use time rather than cycles as the basis of measurement - DJB has a tool for this which he can show us how to use

(b) benchmark our current implementation to get a performance baseline. As we're going to be switching packet formats soon, it probably makes more sense to do this with Outfox rather than Sphinx.

jstuczyn commented 1 year ago

note: internally in sphinx we're using curve25519-dalek directly as opposed to ed25519-dalek as we needed to be able to multiply two scalars together for optimisation purposes (which is not possible with ed)