mirror of
https://github.com/rosenpass/rosenpass.git
synced 2025-12-27 13:14:57 -08:00
Add benchmarking for cryptographic primitives and protocol performance
This commit introduces two kinds of benchmarks: 1. Cryptographic Primitives. Measures the performance of all available implementations of cryptographic algorithms using traditional benchmarking. Uses criterion. 2. Protocol Runs. Measures the time each step in the protocol takes. Measured using a tracing-based approach. The benchmarks are run on CI and an interactive visual overview is written to the gh-pages branch. If a benchmark takes more than twice the time than the reference commit (for PR: the main branch), the action fails.
This commit is contained in:
@@ -24,6 +24,9 @@ thiserror = { workspace = true }
|
||||
mio = { workspace = true }
|
||||
tempfile = { workspace = true }
|
||||
uds = { workspace = true, optional = true, features = ["mio_1xx"] }
|
||||
libcrux-test-utils = { workspace = true, optional = true }
|
||||
lazy_static = { workspace = true, optional = true }
|
||||
|
||||
[features]
|
||||
experiment_file_descriptor_passing = ["uds"]
|
||||
trace_bench = ["dep:libcrux-test-utils", "dep:lazy_static"]
|
||||
|
||||
@@ -36,3 +36,6 @@ pub mod typenum;
|
||||
pub mod zerocopy;
|
||||
/// Memory wiping utilities.
|
||||
pub mod zeroize;
|
||||
/// Trace benchmarking utilities
|
||||
#[cfg(feature = "trace_bench")]
|
||||
pub mod trace_bench;
|
||||
|
||||
19
util/src/trace_bench.rs
Normal file
19
util/src/trace_bench.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use libcrux_test_utils::tracing;
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
/// The trace value used in all Rosepass crates.
|
||||
pub static ref TRACE: RpTrace = RpTrace::default();
|
||||
}
|
||||
|
||||
/// The trace type used to trace Rosenpass for performance measurement.
|
||||
pub type RpTrace = tracing::MutexTrace<&'static str, Instant>;
|
||||
|
||||
/// The trace event type used to trace Rosenpass for performance measurement.
|
||||
pub type RpEventType = tracing::TraceEvent<&'static str, Instant>;
|
||||
|
||||
// Re-export to make functionality availalable and callers don't need to also directly depend on
|
||||
// [`libcrux_test_utils`].
|
||||
pub use libcrux_test_utils::tracing::trace_span;
|
||||
pub use tracing::Trace;
|
||||
Reference in New Issue
Block a user