diff options
| author | mat <27899617+mat-1@users.noreply.github.com> | 2022-08-19 14:14:08 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-19 14:14:08 -0500 |
| commit | ac4d675d44a93a6625f508263c650206a7ff1f98 (patch) | |
| tree | 38822285da0b365bfd7f2e347d19e1e2db78bd46 /azalea-nbt/src/encode.rs | |
| parent | b9cb596ea75b446d19e6ad066c750348be60f4c7 (diff) | |
| download | azalea-drasl-ac4d675d44a93a6625f508263c650206a7ff1f98.tar.xz | |
NBT decoder optimizations (#17)
* replace HashMap with AHashMap
* faster read_string by just doing read_exact
* re-enable all the benchmarks
Diffstat (limited to 'azalea-nbt/src/encode.rs')
| -rwxr-xr-x | azalea-nbt/src/encode.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/azalea-nbt/src/encode.rs b/azalea-nbt/src/encode.rs index 3763ffd1..1bb8f366 100755 --- a/azalea-nbt/src/encode.rs +++ b/azalea-nbt/src/encode.rs @@ -1,9 +1,9 @@ use crate::Error; use crate::Tag; +use ahash::AHashMap; use azalea_buf::McBufWritable; use byteorder::{WriteBytesExt, BE}; use flate2::write::{GzEncoder, ZlibEncoder}; -use std::collections::HashMap; use std::io::Write; // who needs friends when you've got code that runs in nanoseconds? @@ -19,7 +19,7 @@ fn write_string(writer: &mut dyn Write, string: &str) -> Result<(), Error> { #[inline] fn write_compound( writer: &mut dyn Write, - value: &HashMap<String, Tag>, + value: &AHashMap<String, Tag>, end_tag: bool, ) -> Result<(), Error> { for (key, tag) in value { |
