From 67c6e333445686e5d7d128e433699ead3a31016a Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 22 Apr 2022 00:52:22 -0500 Subject: [PATCH] fix nbt decode benchmark --- azalea-nbt/benches/my_benchmark.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/azalea-nbt/benches/my_benchmark.rs b/azalea-nbt/benches/my_benchmark.rs index 7b44d610..df619c3d 100755 --- a/azalea-nbt/benches/my_benchmark.rs +++ b/azalea-nbt/benches/my_benchmark.rs @@ -29,12 +29,14 @@ fn bench_serialize(filename: &str, c: &mut Criterion) { group.throughput(Throughput::Bytes(decoded_src.len() as u64)); // idk if this is criterion's fault or rust's fault but the async benchmark doesn't compile - // group.bench_function("Decode", |b| { - // b.to_async(tokio::runtime::Runtime::new().unwrap();).iter(|| async { - // decoded_src_stream.seek(SeekFrom::Start(0)).unwrap(); - // Tag::read(&mut decoded_src_stream).await.unwrap(); - // }) - // }); + group.bench_function("Decode", |b| { + b.to_async(tokio::runtime::Runtime::new().unwrap()) + .iter(|| async { + let mut owned_decoded_src_stream = decoded_src_stream.clone(); + owned_decoded_src_stream.seek(SeekFrom::Start(0)).unwrap(); + Tag::read(&mut owned_decoded_src_stream).await.unwrap(); + }) + }); group.bench_function("Encode", |b| { b.iter(|| {