Skip to content

Commit

Permalink
fix stun benches
Browse files Browse the repository at this point in the history
  • Loading branch information
yngrtc committed Mar 2, 2024
1 parent dd7992e commit 98775b5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ log = "0.4.16"
thiserror = "1.0"

[dev-dependencies]
env_logger = "0.9.0"
env_logger = "0.11"
chrono = "0.4.23"
8 changes: 4 additions & 4 deletions dtls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ p256 = { version = "0.13", features = ["default", "ecdh", "ecdsa"] }
p384 = "0.13"
rand = "0.8"
hmac = "0.12"
sec1 = { version = "0.7", features = [ "std" ] }
sec1 = { version = "0.7", features = ["std"] }
sha1 = "0.10"
sha2 = "0.10"
aes = "0.8"
cbc = { version = "0.1", features = [ "block-padding", "alloc"] }
cbc = { version = "0.1", features = ["block-padding", "alloc"] }
aes-gcm = "0.10"
ccm = "0.5"
x25519-dalek = { version = "2", features = ["static_secrets"] }
x509-parser = "0.15"
der-parser = "8.1"
rcgen = "0.11"
ring = "0.17"
rustls = { version = "0.21", features = ["dangerous_configuration"]}
rustls = { version = "0.21", features = ["dangerous_configuration"] }
bincode = "1"
serde = { version = "1", features = ["derive"] }
subtle = "2"
Expand All @@ -41,7 +41,7 @@ pem = { version = "3", optional = true }
local-sync = "0.1.0"
core_affinity = "0.8.0"
chrono = "0.4.23"
env_logger = "0.10.0"
env_logger = "0.11"
clap = { version = "4.2.2", features = ["derive"] }
anyhow = "1.0.70"
ctrlc = "3.2.5"
Expand Down
2 changes: 1 addition & 1 deletion rtp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ serde = { version = "1.0.102", features = ["derive"] }

[dev-dependencies]
chrono = "0.4.31"
criterion = "0.4.0"
criterion = "0.5"

[[bench]]
name = "packet_bench"
Expand Down
2 changes: 1 addition & 1 deletion sdp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ thiserror = "~1.0.10"
substring = "1.4"

[dev-dependencies]
criterion = "0.4.0"
criterion = "0.5"

[[bench]]
name = "bench"
Expand Down
2 changes: 1 addition & 1 deletion stun/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ thiserror = "1.0"

[dev-dependencies]
clap = "3.2.6"
criterion = "0.4.0"
criterion = "0.5"

[[bench]]
name = "bench"
Expand Down
11 changes: 5 additions & 6 deletions stun/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@ use rand::rngs::StdRng;
use rand::{Rng, SeedableRng};
use std::io::Cursor;
use std::net::Ipv4Addr;
use std::ops::{Add, Sub};
use std::time::Duration;
use stun::addr::{AlternateServer, MappedAddress};
use stun::agent::{noop_handler, Agent, TransactionId};
use stun::attributes::{
ATTR_CHANNEL_NUMBER, ATTR_DONT_FRAGMENT, ATTR_ERROR_CODE, ATTR_MESSAGE_INTEGRITY, ATTR_NONCE,
ATTR_REALM, ATTR_SOFTWARE, ATTR_USERNAME, ATTR_XORMAPPED_ADDRESS,
};
use stun::error_code::{ErrorCode, ErrorCodeAttribute, CODE_STALE_NONCE};
use stun::fingerprint::{FINGERPRINT, FINGERPRINT_SIZE};
use stun::integrity::MessageIntegrity;
use stun::message::TransactionId;
use stun::message::{
is_message, Getter, Message, MessageType, Setter, ATTRIBUTE_HEADER_SIZE, BINDING_REQUEST,
CLASS_REQUEST, MESSAGE_HEADER_SIZE, METHOD_BINDING,
};
use stun::textattrs::{Nonce, Realm, Software, Username};
use stun::uattrs::UnknownAttributes;
use stun::xoraddr::{xor_bytes, XorMappedAddress};
use tokio::time::Instant;

// AGENT_COLLECT_CAP is initial capacity for Agent.Collect slices,
// sufficient to make function zero-alloc in most cases.
const AGENT_COLLECT_CAP: usize = 100;
// const AGENT_COLLECT_CAP: usize = 100;

fn benchmark_addr(c: &mut Criterion) {
let mut m = Message::new();
Expand Down Expand Up @@ -53,6 +50,7 @@ fn benchmark_addr(c: &mut Criterion) {
});
}

/*
fn benchmark_agent(c: &mut Criterion) {
let deadline = Instant::now().add(Duration::from_secs(60 * 60 * 24));
let gc_deadline = deadline.sub(Duration::from_secs(1));
Expand Down Expand Up @@ -89,6 +87,7 @@ fn benchmark_agent(c: &mut Criterion) {
a.close().unwrap();
}
}
*/

fn benchmark_attributes(c: &mut Criterion) {
{
Expand Down Expand Up @@ -640,7 +639,7 @@ fn benchmark_xoraddr(c: &mut Criterion) {
criterion_group!(
benches,
benchmark_addr,
benchmark_agent,
//TODO: benchmark_agent,
benchmark_attributes,
//TODO: benchmark_client,
benchmark_error_code,
Expand Down

0 comments on commit 98775b5

Please sign in to comment.