aquatic_http: rewrite request parsing, use smartstring

Use smartstring in PeerMapKey too.

Improves benchmark speed.

request-from-path:

time:   [2.1484 us 2.1530 us 2.1586 us]
change: [-24.246% -23.908% -23.570%] (p = 0.00 < 0.01)
Performance has improved.
This commit is contained in:
Joakim Frostegård 2020-07-19 15:21:11 +02:00
parent fc9b4c8e0d
commit 9df1f0ecc6
10 changed files with 1069 additions and 1057 deletions

View file

@ -8,6 +8,7 @@ use indexmap::IndexMap;
use log::error;
use mio::Token;
use parking_lot::Mutex;
use smartstring::{SmartString, LazyCompact};
pub use aquatic_common::{ValidUntil, convert_ipv4_mapped_ipv4};
@ -90,7 +91,7 @@ impl <I: Ip>Peer<I> {
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct PeerMapKey<I: Ip> {
pub peer_id: PeerId,
pub ip_or_key: Either<I, String>
pub ip_or_key: Either<I, SmartString<LazyCompact>>
}