emacs-devel
[Top][All Lists]
Advanced

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

Re: Crashes in "C-h h"


From: Pip Cet
Subject: Re: Crashes in "C-h h"
Date: Thu, 4 Jul 2019 04:50:17 +0000

On Wed, Jul 3, 2019 at 9:05 PM Paul Eggert <address@hidden> wrote:
> >> As Eli's revised code suggests, if n is in fixnum range, then instead of
> >> (FIXNUMP (x) && XFIXNUM (x) == n) it's typically a bit cleaner (and 
> >> faster) to
> >> write EQ (x, make_fixnum (n)).
>
> > It normally shouldn't matter either way, but in that case the
> > comparison is done in a loop, so the make_fixnum call can be done just
> > once, outside the loop, which AFAIU makes the loop a tad faster.
>
> Although it indeed doesn't matter normally, the EQ+make_fixnum version
> should be smaller and faster in typical use, even without hoisting the
> make_fixnum out of a loop.

When they're equivalent, EQ+make_fixnum seems more readable to me, too.

> I just now ran the attached microbenchmark on
> a Xeon E5-2640 v2 with code compiled by GCC 9.1 x86-64, and got these
> results:

Funnily, I get the same timings for each of the three versions on this machine:

model name    : Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz

with trunk GCC.

But the assembly code generated is clearly better for the make_fixnum
version (as a nitpick, f and g aren't equivalent, but the code
produced is worse for f even with assume()s that make it equivalent to
g).



reply via email to

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