mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
Replace Hash Algorithm in HashMap/Set with FxHashMap/Set for simple types (#39166)
FxHash is faster than FnvHash and SipHash for simple types up to at least 64 bytes. The cryptographic guarantees are not needed for any types changed here because they are simple ids. This changes the types in script and net crates. In a future PR we will change the remaining Fnv to be also Fx unless there is a reason to keep them as Fnv. Testing: Should not change functionality but unit test and wpt will find it. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
1deb7b5957
commit
177f6d6502
46 changed files with 226 additions and 215 deletions
|
@ -3,7 +3,6 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::collections::HashMap;
|
||||
use std::ptr::{self};
|
||||
use std::rc::Rc;
|
||||
|
||||
|
@ -13,6 +12,7 @@ use dom_struct::dom_struct;
|
|||
use js::jsapi::{Heap, IsPromiseObject, JSObject};
|
||||
use js::jsval::{JSVal, ObjectValue, UndefinedValue};
|
||||
use js::rust::{HandleObject as SafeHandleObject, HandleValue as SafeHandleValue, IntoHandle};
|
||||
use rustc_hash::FxHashMap;
|
||||
use script_bindings::callback::ExceptionHandling;
|
||||
use script_bindings::realms::InRealm;
|
||||
|
||||
|
@ -1193,7 +1193,7 @@ impl Transferable for TransformStream {
|
|||
|
||||
fn serialized_storage<'a>(
|
||||
data: StructuredData<'a, '_>,
|
||||
) -> &'a mut Option<HashMap<MessagePortId, Self::Data>> {
|
||||
) -> &'a mut Option<FxHashMap<MessagePortId, Self::Data>> {
|
||||
match data {
|
||||
StructuredData::Reader(r) => &mut r.transform_streams_port_impls,
|
||||
StructuredData::Writer(w) => &mut w.transform_streams_port,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue