From d1426d3ac59d307626e652eab462fb4646ea5d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sun, 4 Feb 2024 00:14:13 +0100 Subject: [PATCH] ws protocol: don't heap-allocate in serialize_20_bytes --- TODO.md | 5 ----- crates/ws_protocol/src/common.rs | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/TODO.md b/TODO.md index 595de1c..aa49dfb 100644 --- a/TODO.md +++ b/TODO.md @@ -43,11 +43,6 @@ * move additional request sending to for each received response, maybe with probability 0.2 -* aquatic_ws - * large amount of temporary allocations in serialize_20_bytes, pretty many in deserialize_20_bytes - * 20 byte parsing: consider using something like ArrayString<80> to avoid - heap allocations - # Not important * aquatic_http: diff --git a/crates/ws_protocol/src/common.rs b/crates/ws_protocol/src/common.rs index 5c0a430..7c429cb 100644 --- a/crates/ws_protocol/src/common.rs +++ b/crates/ws_protocol/src/common.rs @@ -84,9 +84,20 @@ fn serialize_20_bytes(data: &[u8; 20], serializer: S) -> Result