[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 17b639aabb 1/2: Avoid possibly unnecessary lisp_time_struct call
From: |
Philip Kaludercic |
Subject: |
master 17b639aabb 1/2: Avoid possibly unnecessary lisp_time_struct call |
Date: |
Thu, 14 Apr 2022 12:39:52 -0400 (EDT) |
branch: master
commit 17b639aabb457ca6ffbcb6fdb73c03571fb0e360
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
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);