[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hash-consing bignums and eq==eql
From: |
Stefan Monnier |
Subject: |
hash-consing bignums and eq==eql |
Date: |
Tue, 28 Aug 2018 10:08:57 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> The whole purpose of hash-consing (for me) is to avoid turning EQ into
> something like:
>
> if (BIGNUMP (x))
> return slow_eq (x, y);
> else
> return x == y;
BTW, hash-consing bignums would have the following advantages:
- EQ is just as fast as before.
- EQ is equivalent to EQL for all integers.
- While bignum operations would be somewhat slower (30-40% according to
a message I can't find any more), they'd still be faster than what
we had before (i.e. which varies between "signals an error" and "uses
a list of cons cells").
Admittedly, if we used a dedicated tag for bignums, eql could turn into
BIGNUM_OR_FLOAT_P (x) ? slow_eql (x, y) : (x == y);
where BIGNUM_OR_FLOAT_P can be just as efficient as FLOATP, so it
would be cheap enough (IMO) to make `eq` an alias for `eql`.
Stefan
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, (continued)
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Stefan Monnier, 2018/08/22
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Pip Cet, 2018/08/23
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Stefan Monnier, 2018/08/23
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Pip Cet, 2018/08/24
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Paul Eggert, 2018/08/24
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Pip Cet, 2018/08/25
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Stefan Monnier, 2018/08/25
- Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Paul Eggert, 2018/08/25
- hash-consing bignums and eq==eql,
Stefan Monnier <=
- Re: hash-consing bignums and eq==eql, Pip Cet, 2018/08/29
- Re: hash-consing bignums and eq==eql, Stefan Monnier, 2018/08/29
- Re: hash-consing bignums and eq==eql, Paul Eggert, 2018/08/29
- Re: hash-consing bignums and eq==eql, Stefan Monnier, 2018/08/29
Re: [Emacs-diffs] master f18af6c: Audit use of lsh and fix glitches, Pip Cet, 2018/08/22