emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some vars now limited to fixnum size. (Was: Merging bignum to master


From: Paul Eggert
Subject: Re: Some vars now limited to fixnum size. (Was: Merging bignum to master)
Date: Mon, 20 Aug 2018 16:15:29 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Pip Cet wrote:
So we now silently replace the argument with another, smaller value,
and then go ahead as if business as usual?  Is that a good,
user-friendly behavior?
It's certainly incorrect for circular lists.

Yes, sorry, I forgot the circular case. Fixed by installing the attached patch.

This patch improves circular-list nthcdr performance for fixnums too. For example, on my Fedora 28 x86-64 platform (AMD Phenom II X4 910e, circa 2010) the third line of the following benchmark runs about 8 million times faster:

(setq bench-circular (list 1 2 3 4 5 6))
(setcdr (nthcdr 5 bench-circular) bench-circular)
(nthcdr 536870911 bench-circular)

Normally I wouldn't bother with this sort of performance improvement (I mean, how often to people write code that deliberately goes around in circles? :-), but nthcdr is used so often that it seemed worth doing. Plus it was fun to fix this mostly by using machine arithmetic rather than GMP.

Attachment: 0001-Speed-up-nthcdr-N-L-when-L-is-circular.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]