News for hackers. Stuff that matters.
Re:How fast are Linux pipes anyway? by GlitchMr on Thursday June 02, 2022 @09:30AM (#31594627)
`process.stdout.write` is different to PHP's `echo` and Python's `print` in that it pushes a write to an event queue without waiting for the result which could result in filling event queue with writes. Instead, you can consider `await`-ing `write` so that it would write before pushing another `write` to an event queue.

    node -e '
        const stdoutWrite = util.promisify(process.stdout.write).bind(process.stdout);
        (async () => {
            while (true) {
                await stdoutWrite("1");
            }
        })();
    ' | pv > /dev/null

There are no comments on this comment yet.