Use HashMap instead of BTreeMap

This reduces the file size from 87KiB to 79KiB.
This commit is contained in:
bjorn3
2024-03-10 14:39:29 +01:00
parent ba7eea3043
commit 626a5af3a4
3 changed files with 14 additions and 3 deletions
+6 -3
View File
@@ -1,9 +1,11 @@
use core::convert::TryFrom;
#[allow(deprecated)]
use core::hash::{BuildHasherDefault, SipHasher};
use core::str;
use alloc::collections::BTreeMap;
use alloc::string::String;
use hashbrown::HashMap;
use redox_initfs::{InitFs, InodeStruct, Inode, InodeDir, InodeKind, types::Timespec};
use syscall::data::{Packet, Stat};
@@ -19,14 +21,15 @@ struct Handle {
filename: String,
}
pub struct InitFsScheme {
handles: BTreeMap<usize, Handle>,
#[allow(deprecated)]
handles: HashMap<usize, Handle, BuildHasherDefault<SipHasher>>,
next_id: usize,
fs: InitFs<'static>,
}
impl InitFsScheme {
pub fn new(bytes: &'static [u8]) -> Self {
Self {
handles: BTreeMap::new(),
handles: HashMap::default(),
next_id: 0,
fs: InitFs::new(bytes).expect("failed to parse initfs"),
}