perf: eliminate loop string allocations and proxy mem spikes

This commit is contained in:
Riz Ashraf committed 2026-09-21 09:40:37 +01:00
1 parent d5a05f8416
commit dc59aa9238
5 files changed
+30 -24

No files matched your search

+2 -2
View File
@@ -96,10 +96,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
if let tokio_tungstenite::tungstenite::Message::Text(text) = msg {
let log_prefix = logger::extract_log_prefix(&text, true);
tracing::info!("<<< [Stub] Received {} from server (length: {}): {}", log_prefix, text.len(), if text.len() > 1000 { format!("{}...", &text[..1000]) } else { text.clone() });
let payload = format!("{}\n", text);
use tokio::io::AsyncWriteExt;
let mut stdout = tokio::io::stdout();
let _ = stdout.write_all(payload.as_bytes()).await;
let _ = stdout.write_all(text.as_bytes()).await;
let _ = stdout.write_all(b"\n").await;
let _ = stdout.flush().await;
}
}