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
|
@ -2,12 +2,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use base::id::{DomExceptionId, DomExceptionIndex};
|
||||
use constellation_traits::DomException;
|
||||
use dom_struct::dom_struct;
|
||||
use js::rust::HandleObject;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::{
|
||||
DOMExceptionConstants, DOMExceptionMethods,
|
||||
|
@ -280,7 +279,7 @@ impl Serializable for DOMException {
|
|||
|
||||
fn serialized_storage<'a>(
|
||||
data: StructuredData<'a, '_>,
|
||||
) -> &'a mut Option<HashMap<DomExceptionId, Self::Data>> {
|
||||
) -> &'a mut Option<FxHashMap<DomExceptionId, Self::Data>> {
|
||||
match data {
|
||||
StructuredData::Reader(reader) => &mut reader.exceptions,
|
||||
StructuredData::Writer(writer) => &mut writer.exceptions,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue