Subject: Re: bug#76103: [PATCH] New function 'process-output'

From: Stefan Kangas <[email-masked]>
Date: Fri, 7 Feb 2025 13:21:57 -0600

Alvaro Ramirez <[email-masked]> writes:

> Thanks Eli.
>
> Eli Zaretskii <[email-masked]> writes:
>
>> I'm not sure a 2.5 boost in performance
>
> (let ((before (benchmark-run 1000
>                 (shell-command-to-string "seq 200")))
>       (after (benchmark-run 1000
>                (process-output "seq" "200"))))
>   (/ (car before)
>      (car after))) => 3.27
>
> Roughly a 3.27 gain, or should I calculate differently?

I would benchmark this against `process-lines` instead, because it
doesn't spawn a shell.  On this macOS machine, I get 1.15 for that
benchmark.

>> (on which platform, btw?) justifies yet another API.
>
> macOS. Need to grab a hold of a linux box to get equivalent
> figure.

AFAIU, the body of the proposed `process-output` could be reduced to

    (string-join (process-lines cmd) "\n")

This makes me doubt if it's worth adding this new API.

To find arguments that would justify the addition, I'd take a look at
emacs.git to see which code we have that it would simplify.  I'd also
take a look at packages on GNU ELPA, NonGNU ELPA, and MELPA, to find
even more supporting evidence.