News for hackers. Stuff that matters.
Re:How fast are Linux pipes anyway? by megous on Thursday June 02, 2022 @08:42AM (#31594078)
"Javascript" is slowest probably because node pushes the writes to a thread instead of printing directly from the main process like PHP.

Python cheats, and it's still slow as heck even while cheating (buffers the output at 8192 chunks instead of issuing 1 byte writes).

write(1, "1", 1) loop in C pushes 6.38MiB/s on my PC. :)

Re:How fast are Linux pipes anyway? by cout on Thursday June 02, 2022 @12:47PM (#31597272)
Why is it cheating to use a buffer? This is the behavior you would get in C if you used the C standard library (putc/fputc) instead of a system call (write).
Re:How fast are Linux pipes anyway? by megous on Thursday June 02, 2022 @08:10PM (#31602335)
Because it doesn't answer the question "how fast individual languages write individual characters to a pipe" if in fact some languages do not.

It's not language "cheating" of course. It's just OP "measuring the wrong thing".

Re:How fast are Linux pipes anyway? by chupasaurus on Thursday June 02, 2022 @07:29PM (#31601954)
If you want to compare apples to apples, you can switch Python to use unbuffered stdout/stderr (via `-u` or fcntl inside the script [0])

[0]: https://stackoverflow.com/a/881751/6001364