Feeling pretty proud of myself for removing a bunch of copies and allocations. Run my benchmark and its regressed from 4s to 82s. :-|
4
72
I think the issue was that I am writing to a TcpStream and in the first code I was writing to a buffer, then copying the buffer into the stream. In the new code, I passed the stream into a function, but the function took a generic `impl Write`.
1
1
Ah, but monomorphisation, you say. In this case, I think that the generics interacted with async and I lost the 'async'-ness of the write call.
2
3
Oh hang on, reduce allocations, hrm. If you want async, surely you're taking an `impl AsyncWrite` though?

Nov 18, 2020 ยท 8:32 AM UTC