Skip to content

Commit

Permalink
Bench: optimise binary data generation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexheretic authored and daniel-abramov committed Dec 13, 2024
1 parent 31532a0 commit f86036c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion benches/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn benchmark(c: &mut Criterion) {
for i in 0_u64..100_000 {
writer
.send(match i {
_ if i % 3 == 0 => Message::Binary(i.to_le_bytes().into()),
_ if i % 3 == 0 => Message::binary(i.to_le_bytes().to_vec()),
_ => Message::Text(format!("{{\"id\":{i}}}")),
})
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion benches/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn benchmark(c: &mut Criterion) {
b.iter(|| {
for i in 0_u64..100_000 {
let msg = match i {
_ if i % 3 == 0 => Message::Binary(i.to_le_bytes().into()),
_ if i % 3 == 0 => Message::binary(i.to_le_bytes().to_vec()),
_ => Message::Text(format!("{{\"id\":{i}}}")),
};
ws.write(msg).unwrap();
Expand Down

0 comments on commit f86036c

Please sign in to comment.