diff options
| author | mat <github@matdoes.dev> | 2023-03-23 19:38:18 +0000 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2023-03-23 19:38:18 +0000 |
| commit | 95925b64fa0e75a7567c9b2361d90d477fc9bf55 (patch) | |
| tree | fd1bc6a0bb2e4e6896899e2302f5b4482cc501d5 /azalea-nbt/src/decode.rs | |
| parent | 5e5682ab52322f33563fd362c622ab7613cc555a (diff) | |
| download | azalea-drasl-95925b64fa0e75a7567c9b2361d90d477fc9bf55.tar.xz | |
nbt lookup optimization
Diffstat (limited to 'azalea-nbt/src/decode.rs')
| -rwxr-xr-x | azalea-nbt/src/decode.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/azalea-nbt/src/decode.rs b/azalea-nbt/src/decode.rs index 5421e1c5..35392b15 100755 --- a/azalea-nbt/src/decode.rs +++ b/azalea-nbt/src/decode.rs @@ -170,8 +170,9 @@ fn read_compound(stream: &mut Cursor<&[u8]>) -> Result<NbtCompound, Error> { } let name = read_string(stream)?; let tag = Nbt::read_known(stream, tag_id)?; - map.insert(name, tag); + map.insert_unsorted(name, tag); } + map.sort(); Ok(map) } @@ -265,7 +266,7 @@ impl Nbt { let name = read_string(stream)?; let tag = Nbt::read_known(stream, tag_id)?; let mut map = NbtCompound::with_capacity(1); - map.insert(name, tag); + map.insert_unsorted(name, tag); Ok(Nbt::Compound(map)) } |
