Subject: Re: bug#44674: 28.0.50; Adding current-cpu-time for performance tests

From: Eli Zaretskii <[email-masked]>
Date: Mon, 16 Nov 2020 09:58:40 +0200

On November 16, 2020 3:07:35 AM GMT+02:00, Stefan Monnier <[email-masked]> wrote:
> Package: Emacs
> Version: 28.0.50
> 
> 
> I tried to write a test for the performance problem seen in bug#41029,
> but found it very difficult to make it work half-reliably because we
> only have access to wall-clock time from Elisp.
> 
> So I suggest we add a new primitive `current-cpu-time` with which
> those
> tests seem to be at least somewhat doable.
> 
> See my current patch below which includes a test for that
> performance bug.  It clearly requires adding w32 support (or
> fetching more clock functionality from gnulib) but I don't know how to
> do that.

AFAIU, using 'clock' here is not the best idea, as there are caveats wrt to calling 'system', and the origin of the returned value is not well defined to be portable.

I suggest to use 'times' instead.  For w32, we could easily implement it, as we already have that functionality for 'getloadavg'.