diff --git a/actix-http/Cargo.toml b/actix-http/Cargo.toml index 0cc8e5cf9..1a4436f96 100644 --- a/actix-http/Cargo.toml +++ b/actix-http/Cargo.toml @@ -58,7 +58,7 @@ encoding_rs = "0.8" futures-channel = { version = "0.3.7", default-features = false } futures-core = { version = "0.3.7", default-features = false } futures-util = { version = "0.3.7", default-features = false, features = ["sink"] } -fxhash = "0.2.1" +ahash = "0.6" h2 = "0.3.0" http = "0.2.2" httparse = "1.3" diff --git a/actix-http/src/client/pool.rs b/actix-http/src/client/pool.rs index 7da2b6234..8926219b2 100644 --- a/actix-http/src/client/pool.rs +++ b/actix-http/src/client/pool.rs @@ -13,7 +13,7 @@ use actix_utils::task::LocalWaker; use bytes::Bytes; use futures_channel::oneshot; use futures_util::future::{poll_fn, FutureExt, LocalBoxFuture}; -use fxhash::FxHashMap; +use ahash::AHashMap; use h2::client::{Connection, SendRequest}; use http::uri::Authority; use indexmap::IndexSet; @@ -59,7 +59,7 @@ where acquired: 0, waiters: Slab::new(), waiters_queue: IndexSet::new(), - available: FxHashMap::default(), + available: AHashMap::default(), waker: LocalWaker::new(), })); @@ -257,7 +257,7 @@ struct AvailableConnection { pub(crate) struct Inner { config: ConnectorConfig, acquired: usize, - available: FxHashMap>>, + available: AHashMap>>, waiters: Slab< Option<( Connect, diff --git a/actix-http/src/extensions.rs b/actix-http/src/extensions.rs index b20dfe11d..e978c1749 100644 --- a/actix-http/src/extensions.rs +++ b/actix-http/src/extensions.rs @@ -1,14 +1,16 @@ -use std::any::{Any, TypeId}; -use std::{fmt, mem}; +use std::{ + any::{Any, TypeId}, + fmt, mem, +}; -use fxhash::FxHashMap; +use ahash::AHashMap; /// A type map of request extensions. #[derive(Default)] pub struct Extensions { /// Use FxHasher with a std HashMap with for faster /// lookups on the small `TypeId` (u64 equivalent) keys. - map: FxHashMap>, + map: AHashMap>, } impl Extensions { @@ -16,7 +18,7 @@ impl Extensions { #[inline] pub fn new() -> Extensions { Extensions { - map: FxHashMap::default(), + map: AHashMap::default(), } } diff --git a/actix-http/src/header/map.rs b/actix-http/src/header/map.rs index 6ab3509f7..adcf579d0 100644 --- a/actix-http/src/header/map.rs +++ b/actix-http/src/header/map.rs @@ -1,8 +1,7 @@ -use std::collections::hash_map::{self, Entry}; -use std::convert::TryFrom; +use std::{collections::hash_map::{self, Entry}, convert::TryFrom}; +use ahash::AHashMap; use either::Either; -use fxhash::FxHashMap; use http::header::{HeaderName, HeaderValue}; /// A set of HTTP headers @@ -10,7 +9,7 @@ use http::header::{HeaderName, HeaderValue}; /// `HeaderMap` is an multi-map of [`HeaderName`] to values. #[derive(Debug, Clone)] pub struct HeaderMap { - pub(crate) inner: FxHashMap, + pub(crate) inner: AHashMap, } #[derive(Debug, Clone)] @@ -55,7 +54,7 @@ impl HeaderMap { /// allocate. pub fn new() -> Self { HeaderMap { - inner: FxHashMap::default(), + inner: AHashMap::default(), } } @@ -69,7 +68,7 @@ impl HeaderMap { /// More capacity than requested may be allocated. pub fn with_capacity(capacity: usize) -> HeaderMap { HeaderMap { - inner: FxHashMap::with_capacity_and_hasher(capacity, Default::default()), + inner: AHashMap::with_capacity_and_hasher(capacity, Default::default()), } } diff --git a/actix-http/src/header/mod.rs b/actix-http/src/header/mod.rs index 0f87516eb..4a74dfb17 100644 --- a/actix-http/src/header/mod.rs +++ b/actix-http/src/header/mod.rs @@ -1,8 +1,6 @@ -//! Various http headers -// This is mostly copy of [hyper](https://github.com/hyperium/hyper/tree/master/src/header) +//! Various HTTP headers. -use std::convert::TryFrom; -use std::{fmt, str::FromStr}; +use std::{convert::TryFrom, fmt, str::FromStr}; use bytes::{Bytes, BytesMut}; use http::Error as HttpError;