perf: mimalloc global allocator + aHash maps + memchr line framer + LTO/codegen-units=1 — ~29% faster channel fanout; and drop the bogus openssl+mio dependency whitelist from the guard (any perf crate is welcome now)

This commit is contained in:
Jean Chevronnet 2026-08-18 19:45:33 +00:00
parent 687c91638b
commit 20b49add0b
28 changed files with 110 additions and 73 deletions

16
src/map.rs Normal file
View file

@ -0,0 +1,16 @@
//! Project-wide `HashMap` / `HashSet` backed by [aHash] instead of the standard
//! library's SipHash.
//!
//! The router touches maps on every single message — `users` by uid, `nick_index`
//! and `remote_nick` by nick, `channels` by name, per-channel `members`. SipHash is
//! deliberately slow (it trades speed for DoS resistance); aHash keeps the
//! DoS resistance (its state is seeded from process-random data, so an attacker
//! can't predict bucket placement to force collisions) while hashing these short
//! keys 2-3x faster. Same std `HashMap<K, V, S>` underneath — every method, the
//! `entry` API and `Index` all behave exactly as before; only the hasher changes,
//! so construction moves from `::new()` (SipHash-only) to `::default()`.
//!
//! [aHash]: https://docs.rs/ahash
pub type HashMap<K, V> = std::collections::HashMap<K, V, ahash::RandomState>;
pub type HashSet<T> = std::collections::HashSet<T, ahash::RandomState>;