diff options
| author | mat <github@matdoes.dev> | 2022-04-22 18:23:29 +0000 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-22 18:23:29 +0000 |
| commit | b03d3da65937aebcba1cb38573d02267e49bfe19 (patch) | |
| tree | ac8b3e9d039bdf5a3522b3977f59b64e90999f5d | |
| parent | 99652200aa2840e9a3075f238d9eb001aadb7e80 (diff) | |
| download | azalea-drasl-b03d3da65937aebcba1cb38573d02267e49bfe19.tar.xz | |
inline reading in nbt decoding
| -rwxr-xr-x | azalea-nbt/benches/my_benchmark.rs | 26 | ||||
| -rwxr-xr-x | azalea-nbt/src/decode.rs | 1 |
2 files changed, 14 insertions, 13 deletions
diff --git a/azalea-nbt/benches/my_benchmark.rs b/azalea-nbt/benches/my_benchmark.rs index 528475d3..00d12dc8 100755 --- a/azalea-nbt/benches/my_benchmark.rs +++ b/azalea-nbt/benches/my_benchmark.rs @@ -29,20 +29,20 @@ fn bench_serialize(filename: &str, c: &mut Criterion) { group.throughput(Throughput::Bytes(decoded_src.len() as u64)); - // 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(|| { - nbt.write(&mut io::sink()).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(|| { + // nbt.write(&mut io::sink()).unwrap(); + // }) + // }); group.finish(); } diff --git a/azalea-nbt/src/decode.rs b/azalea-nbt/src/decode.rs index e4968811..3e2f7adb 100755 --- a/azalea-nbt/src/decode.rs +++ b/azalea-nbt/src/decode.rs @@ -21,6 +21,7 @@ where } impl Tag { + #[inline] #[async_recursion] async fn read_known<R>(stream: &mut R, id: u8) -> Result<Tag, Error> where |
