aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-22 00:52:22 -0500
committermat <github@matdoes.dev>2022-04-22 00:52:22 -0500
commit67c6e333445686e5d7d128e433699ead3a31016a (patch)
tree3edb1d5d1cf662b54fbcda3a9d7d7f2fb7ccbda6
parent1bbd8b99b39a9c75f9d902d50852d91b3d04add9 (diff)
downloadazalea-drasl-67c6e333445686e5d7d128e433699ead3a31016a.tar.xz
fix nbt decode benchmark
-rwxr-xr-xazalea-nbt/benches/my_benchmark.rs14
1 files 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(|| {