From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#44674: 28.0.50; Adding current-cpu-time for performance tests Date: Mon, 16 Nov 2020 15:10:10 -0500 Message-ID: References: <83y2j1rz2f.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20150"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , 44674@debbugs.gnu.org To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 16 21:17:41 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kekwV-00055h-BU for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Nov 2020 21:17:39 +0100 Original-Received: from localhost ([::1]:36350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kekwU-0006oJ-99 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Nov 2020 15:17:38 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kekq6-0007XJ-PB for bug-gnu-emacs@gnu.org; Mon, 16 Nov 2020 15:11:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kekq6-00076N-EM for bug-gnu-emacs@gnu.org; Mon, 16 Nov 2020 15:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kekq6-0006dP-A5 for bug-gnu-emacs@gnu.org; Mon, 16 Nov 2020 15:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Nov 2020 20:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44674 X-GNU-PR-Package: emacs Original-Received: via spool by 44674-submit@debbugs.gnu.org id=B44674.160555742025453 (code B ref 44674); Mon, 16 Nov 2020 20:11:02 +0000 Original-Received: (at 44674) by debbugs.gnu.org; 16 Nov 2020 20:10:20 +0000 Original-Received: from localhost ([127.0.0.1]:57405 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kekpQ-0006cT-5i for submit@debbugs.gnu.org; Mon, 16 Nov 2020 15:10:20 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:44233) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kekpO-0006cD-EO for 44674@debbugs.gnu.org; Mon, 16 Nov 2020 15:10:19 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E76AB4415EA; Mon, 16 Nov 2020 15:10:12 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6A7F144156E; Mon, 16 Nov 2020 15:10:11 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1605557411; bh=xRV4Kjlb0vDa52PpATwJ0GhyhYJjvMyAa/hlB23KwL8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=TrJPRbq1g/p5i0qf33ytKarupm0OO0Yh+JCb9fITzARIYwP5QoWakPSPX/KEvvUDk OEYD9BXIAQrPzTjq0Upd3u/7wxbaNCOxT1GtsLa8mtKRzRnqUxnRpO+dfhlZeMzQET ROPaLiZtM1RIbOeuzXWsffl3jVxT4++oShG7cet/b0plcVIxxvayxg9lquZfWHmqH2 y/56JNRqF70ERAsjFBTHTBwmMmUAoKTdk5TDlGh6zVk4FRILIua1y7mJYZozn4oIul z8wUagcSCgHRsiICgmJSQTsFVqwA5e4YSNrDh20SXkGpcM5MAvrjsINFoxOKbJXWVJ CeHOFH+DX4MMw== Original-Received: from alfajor (unknown [157.52.9.240]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 34EA71202A7; Mon, 16 Nov 2020 15:10:11 -0500 (EST) In-Reply-To: (Philipp Stephani's message of "Mon, 16 Nov 2020 19:32:35 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:193469 Archived-At: >> > > 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. >> > >> > What do you mean by "origin" and by "calling 'system'"? >> >> Quoting https://pubs.opengroup.org/onlinepubs/9699919799/: >> >> The clock() function shall return the implementation's best >> approximation to the processor time used by the process >> since the beginning of an implementation-defined era >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> related only to the process invocation. >> >> How do you write portable Lisp code that returns consistent results >> based on such shaky foundations? > > For non-walltime clocks, only the difference between two measurements > is meaningful. Mabe the API we should expose should give access to the actual time but only to time-differences, as in: (funcall-with-cpu-time FUNCTION) Call FUNCTION and return the CPU time used. The return value is of the form (TIME . VALUE) where TIME is the CPU time used during execution of FUNCTION, measured in seconds, and VALUE is the return value of FUNCTION. -- Stefan