mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 06:16:04 +00:00
inline reading in nbt decoding
This commit is contained in:
parent
99652200aa
commit
b03d3da659
2 changed files with 14 additions and 13 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ where
|
|||
}
|
||||
|
||||
impl Tag {
|
||||
#[inline]
|
||||
#[async_recursion]
|
||||
async fn read_known<R>(stream: &mut R, id: u8) -> Result<Tag, Error>
|
||||
where
|
||||
|
|
Loading…
Add table
Reference in a new issue