]> git.eshelyaron.com Git - emacs.git/commit
Avoid mpz for some common timestamp cases
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 11 Jul 2024 13:28:58 +0000 (15:28 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 11 Jul 2024 14:39:53 +0000 (16:39 +0200)
commit37d6fcd92a0ff8d86b7392479e101514c541f403
treea8a484fd6e9674dd978118de993124493ca54266
parent33e9c13e5b866618187da29599544f422ba2beca
Avoid mpz for some common timestamp cases

Performance problem reported by Gerd Möllmann and Mattias Engdegård in:
https://lists.gnu.org/r/emacs-devel/2024-06/msg00530.html
https://lists.gnu.org/r/emacs-devel/2024-06/msg00539.html
* src/timefns.c (CFORM_SECS_ONLY): The exact tv_nsec value is now
ignored if nonnegative (i.e., the only thing that matters is that
it’s nonnegative).
(decode_time_components): Use intmax_t instead of mpz arithmetic
if the tick count fits.  Add another ‘default: eassume (false);’
so that the revised code pacifies --enable-gcc-warnings with GCC
11.4.0 on x86-64.

(cherry picked from commit e30706fd12bce459b56123ad36a4e8c1c9d374e1)
src/timefns.c