mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-07 20:41:50 +00:00
492bba9242
* claim: #6389 * perf: write each control reply to the socket in one piece The control server wrote each reply with writeln!(out, "{reply}") on the unbuffered TcpStream. Formatting a serde_json::Value hands the writer every string, number and punctuation mark separately, so each became its own write system call. A reply of a few megabytes (component.list on a design with thousands of components) took about half a second to send. Every reply is now serialized to one buffer and written at once. Writing one large Value to a loopback TcpStream: 1.79 MB took 1,052 ms with writeln! and 4.9 ms with one write_all. The test counts the write calls for a 2000-component reply (one) and reads it back.