I'm sending messages over TCP. To delimit them, I send the size over 4 bytes, then I send the message. Reading the message body is fast, but unintuitively, reading the much smaller size bytes is slow --- if I switch the delimitation to read_until('\n'), getting rid of the size writing/reading all together, my program is much faster.
I'm sending messages over TCP. To delimit them, I send the size over 4 bytes, then I send the message. Reading the message body is fast, but unintuitively, reading the much smaller size bytes is slow --- if I switch the delimitation to
read_until('\n')
, getting rid of the size writing/reading all together, my program is much faster.