From unknown Mon Jun 23 04:10:43 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#54930 <54930@debbugs.gnu.org> To: bug#54930 <54930@debbugs.gnu.org> Subject: Status: [PATCH] Avoid possibly unnecessary lisp_time_struct call Reply-To: bug#54930 <54930@debbugs.gnu.org> Date: Mon, 23 Jun 2025 11:10:43 +0000 retitle 54930 [PATCH] Avoid possibly unnecessary lisp_time_struct call reassign 54930 emacs submitter 54930 Philip Kaludercic severity 54930 normal tag 54930 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 14 06:12:14 2022 Received: (at submit) by debbugs.gnu.org; 14 Apr 2022 10:12:14 +0000 Received: from localhost ([127.0.0.1]:55271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1newSU-0003xK-Fr for submit@debbugs.gnu.org; Thu, 14 Apr 2022 06:12:14 -0400 Received: from lists.gnu.org ([209.51.188.17]:54438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1newST-0003x9-BK for submit@debbugs.gnu.org; Thu, 14 Apr 2022 06:12:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1newST-0005Q9-67 for bug-gnu-emacs@gnu.org; Thu, 14 Apr 2022 06:12:13 -0400 Received: from mout02.posteo.de ([185.67.36.66]:47215) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1newSQ-0008Ht-N8 for bug-gnu-emacs@gnu.org; Thu, 14 Apr 2022 06:12:12 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id B870E240107 for ; Thu, 14 Apr 2022 12:12:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1649931124; bh=OZUt37y2GKwrzvquiaFy8aYF/3Yq2rbeU7j01yEDusg=; h=From:To:Subject:Autocrypt:Date:From; b=UFkCJxDQZyt3D1yuDEExh3tA5endaOLxyFHh/kv2iXPXQhr5lNa3zagsZMFTbFXvm DErzkCs2J9Qbl5ECfBm4Rr/TPje2fT42K+G7FEFlZK149RTsAilrdmynpfaMZj4Xlq vhbpHaXro0lZ5d6PsW1fNaLlnjopAgbYY2XeeYmopLRKha1YP7wE3DtKz4cb5dtg13 WMDTnEtHN4y/eqbvguDDL1hXLy+nXf+W/Bt3S69epZP94xam6gc/Hda+ma1zcWQoza YroyiC89ir9yF8QzFomOIf/zxr9dvfa/VjcET6lQJIPZFPLW5sCT2O6TDNUIu6KvpO cngZAdrHZiyHQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4KfFch2NWQz6tn5 for ; Thu, 14 Apr 2022 12:12:04 +0200 (CEST) From: Philip Kaludercic To: bug-gnu-emacs@gnu.org Subject: [PATCH] Avoid possibly unnecessary lisp_time_struct call Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB Date: Thu, 14 Apr 2022 10:12:03 +0000 Message-ID: <877d7s55zg.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Tags: patch Reading through time_cmp, I didn't understand why the lisp_time struct was calculated for the first argument before checking if both are eq. >From what I see lisp_time struct is not a destructive function, so it should be possible to call the function when calculating the lisp_time struct for the second argument. In GNU Emacs 29.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0) of 2022-04-10 built on viero Repository revision: 0023cfdc4e6d348519198cf75553d1afad0ed153 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: Guix System Configured using: 'configure PKG_CONFIG_PATH=/home/philip/.guix-profile/lib/pkgconfig:/home/philip/.guix-profile/share/pkgconfig' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Avoid-possibly-unnecessary-lisp_time_struct-call.patch >From 1a94c8fc3256c8d73e4b7f4d8a16aab52bb952d9 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Thu, 14 Apr 2022 11:00:07 +0200 Subject: [PATCH] Avoid possibly unnecessary lisp_time_struct call * timefns.c (time_cmp): Defer the calculation of the time struct, in case A and B are eq to one another. --- src/timefns.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/timefns.c b/src/timefns.c index 9e8592d35a..6cfb787af8 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -1219,8 +1219,6 @@ time_cmp (Lisp_Object a, Lisp_Object b) return da < db ? -1 : da != db; } - struct lisp_time ta = lisp_time_struct (a, 0); - /* Compare nil to nil correctly, and handle other eq values quicker while we're at it. Compare here rather than earlier, to handle NaNs and check formats. */ @@ -1229,6 +1227,7 @@ time_cmp (Lisp_Object a, Lisp_Object b) /* Compare (ATICKS . AZ) to (BTICKS . BHZ) by comparing ATICKS * BHZ to BTICKS * AHZ. */ + struct lisp_time ta = lisp_time_struct (a, 0); struct lisp_time tb = lisp_time_struct (b, 0); mpz_t const *za = bignum_integer (&mpz[0], ta.ticks); mpz_t const *zb = bignum_integer (&mpz[1], tb.ticks); -- 2.34.0 --=-=-= Content-Type: text/plain -- Philip Kaludercic --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 14 09:54:13 2022 Received: (at 54930) by debbugs.gnu.org; 14 Apr 2022 13:54:13 +0000 Received: from localhost ([127.0.0.1]:55674 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nezvI-0003mw-Qe for submit@debbugs.gnu.org; Thu, 14 Apr 2022 09:54:12 -0400 Received: from quimby.gnus.org ([95.216.78.240]:40740) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nezvH-0003mc-OS for 54930@debbugs.gnu.org; Thu, 14 Apr 2022 09:54:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=48W8fRi+7BQgaGWcBUa0qhascvSmAQioifG4ksBSzI4=; b=C3Mx/hkhV0I2iz5gPjCiz+q18t L9Ua/DZg37+Rjei2tC0ZS1M6xmTb6ef316UO0CAmo4kli2oOOE/kyHO+lr8glsB0t9I1tQ3WLuGDH HlygKqXw8uqfKI/YpGLg0C/9NFx8zTgpmfaVtpq9M8cscx01JrqOE+JjT0chU6a8Saeg=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nezv9-00028n-Em; Thu, 14 Apr 2022 15:54:05 +0200 From: Lars Ingebrigtsen To: Philip Kaludercic Subject: Re: bug#54930: [PATCH] Avoid possibly unnecessary lisp_time_struct call References: <877d7s55zg.fsf@posteo.net> Date: Thu, 14 Apr 2022 15:54:02 +0200 In-Reply-To: <877d7s55zg.fsf@posteo.net> (Philip Kaludercic's message of "Thu, 14 Apr 2022 10:12:03 +0000") Message-ID: <871qxzn539.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Philip Kaludercic writes: > Reading through time_cmp, I didn't understand why the lisp_time struct > was calculated for the first argument before checking if both are eq. >>From what I see lisp_time struct is not a destructive [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 54930 Cc: 54930@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Philip Kaludercic writes: > Reading through time_cmp, I didn't understand why the lisp_time struct > was calculated for the first argument before checking if both are eq. >>>From what I see lisp_time struct is not a destructive function, so it > should be possible to call the function when calculating the lisp_time > struct for the second argument. Looks good to me; please go ahead and push. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 15 03:44:37 2022 Received: (at control) by debbugs.gnu.org; 15 Apr 2022 07:44:37 +0000 Received: from localhost ([127.0.0.1]:58039 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nfGdB-0004BW-6n for submit@debbugs.gnu.org; Fri, 15 Apr 2022 03:44:37 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nfGd9-0004BG-Mq for control@debbugs.gnu.org; Fri, 15 Apr 2022 03:44:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Td1gMhzvHOUVR8rtHxVw410Z0gWJgonqvhlCRLM22sI=; b=RHOU7JSwYs+m9SNlR5alDbNuH5 05h/lcD7dy1osrEorBsTijLi8iqFqDtUVx3M84Z7mMEVVwHbi5KVmXa/bY9/u4IcpWFTm6O4HV/1n cWq50jD1rdu9x10Rxh//QLyJVxdRrkKvcZwy6n7TAeOONomUoqGMgPgLh/EU91/cTvdI=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nfGd1-0007ut-Ut for control@debbugs.gnu.org; Fri, 15 Apr 2022 09:44:29 +0200 Date: Fri, 15 Apr 2022 09:44:27 +0200 Message-Id: <87lew6iyec.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #54930 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 54930 29.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 54930 29.1 quit From unknown Mon Jun 23 04:10:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 13 May 2022 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator