Use AHash in map_keyed

This commit is contained in:
Greg Johnston 2022-10-12 08:38:15 -04:00
parent c9b2a9d5e0
commit f71ce198de
2 changed files with 5 additions and 3 deletions

View file

@ -8,8 +8,9 @@ repository = "https://github.com/gbj/leptos"
description = "Core functionality for the Leptos web framework."
[dependencies]
ahash = "0.8"
leptos_dom = { path = "../leptos_dom", version = "0.0.4" }
leptos_macro = { path = "../leptos_macro", version = "0.0.3" }
leptos_macro = { path = "../leptos_macro", version = "0.0.4" }
leptos_reactive = { path = "../leptos_reactive", version = "0.0.4" }
log = "0.4"

View file

@ -1,7 +1,8 @@
use ahash::AHashMap;
use leptos_reactive::{
create_effect, create_memo, create_signal, Memo, ReadSignal, Scope, ScopeDisposer,
};
use std::{collections::HashMap, fmt::Debug, hash::Hash, ops::IndexMut};
use std::{fmt::Debug, hash::Hash, ops::IndexMut};
/// Function that maps a `Vec` to another `Vec` via a map function. The mapped `Vec` is lazy
/// computed; its value will only be updated when requested. Modifications to the
@ -85,7 +86,7 @@ where
// 0) Prepare a map of indices in newItems. Scan backwards so we encounter them in
// natural order.
let mut new_indices = HashMap::with_capacity(new_end - start);
let mut new_indices = AHashMap::with_capacity(new_end - start);
// Indexes for new_indices_next are shifted by start because values at 0..start are
// always None.