Skip to content

Commit

Permalink
update benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Brzozowski committed Dec 29, 2024
1 parent f151857 commit 1b25651
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ optional = true
anyhow = "1"
env_logger = "0.10.1"
ansi_term = "0.12.1"
tungstenite = "0.21.0"
tungstenite = "0.26.1"
criterion = "0.5.1"

[lints.clippy]
Expand All @@ -63,6 +63,8 @@ dead_code = "warn"

[profile.release]
debug = true
lto = true
codegen-units = 1

[[bench]]
name = "latency"
Expand Down
6 changes: 3 additions & 3 deletions benches/latency/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::net::TcpStream;

use ::tungstenite::{connect, Message};
use criterion::{black_box, criterion_group, criterion_main, Criterion, Throughput};
use url::Url;
use tungstenite::Utf8Bytes;

use ::boomnet::stream::buffer::IntoBufferedStream;
use ::boomnet::ws::IntoWebsocket;
Expand Down Expand Up @@ -48,11 +48,11 @@ fn tungstenite_rtt_benchmark(c: &mut Criterion) {
server::start_on_thread(9001);

// setup client
let (mut ws, _) = connect(Url::parse("ws://127.0.0.1:9001").unwrap()).unwrap();
let (mut ws, _) = connect("ws://127.0.0.1:9001").unwrap();

group.bench_function("tungstenite_rtt", |b| {
b.iter(|| {
ws.write(Message::Text(MSG.to_owned())).unwrap();
ws.write(Message::Text(Utf8Bytes::from_static(MSG))).unwrap();
ws.flush().unwrap();
if let Message::Text(data) = ws.read().unwrap() {
black_box(data);
Expand Down

0 comments on commit 1b25651

Please sign in to comment.