From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: Crashes in "C-h h" Date: Thu, 4 Jul 2019 04:50:17 +0000 Message-ID: References: <83y31hes6r.fsf@gnu.org> <83r279epwe.fsf@gnu.org> <09f72051-d740-9115-c6fd-c4344c749568@cs.ucla.edu> <83muhvd9nm.fsf@gnu.org> <9b78b85d-a3c8-761f-e500-d51d4a985fa8@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="156551"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Eli Zaretskii , emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 04 06:51:55 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hitit-000ebe-5C for ged-emacs-devel@m.gmane.org; Thu, 04 Jul 2019 06:51:55 +0200 Original-Received: from localhost ([::1]:42840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hitir-0003xx-OO for ged-emacs-devel@m.gmane.org; Thu, 04 Jul 2019 00:51:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60171) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hitiB-0003wW-Dm for emacs-devel@gnu.org; Thu, 04 Jul 2019 00:51:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hitiA-0005Al-BJ for emacs-devel@gnu.org; Thu, 04 Jul 2019 00:51:11 -0400 Original-Received: from mail-ot1-x32f.google.com ([2607:f8b0:4864:20::32f]:37715) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hiti8-00056x-H6; Thu, 04 Jul 2019 00:51:08 -0400 Original-Received: by mail-ot1-x32f.google.com with SMTP id s20so4731709otp.4; Wed, 03 Jul 2019 21:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KejWig8AsEIxLVrSv/J15uCwWDN/AuT/rTircRNN6JE=; b=H5Dr4yYPH/nE8LULiBzs1p/Du0HjjIyMnE9L6P+3XYV7yqX9O5kmntgo3xZmx/6S4M FEj+YX1zoG8AcRo/Mz8boHayDPvtH74Nj/o6zD0bquHFovhE3BwE5m6wm4VHM52cSp49 U1s+XbtqBvs0fVfnWIr0fxpDT+fhhHCZff91uS5qZWYe9Gl60Gd2N6B0BQerBfFRgEE5 wd3qpcNJsACnek/h1am+fmEJJ4GcwMeCgFuDJhS6m7UcRGRys9Uerhra1+NpgAg89spa k6SkGbFHpXHQmd8iqRgKaRH5Ce1qqbAmLAmGzNI0umOJP+1JcuFLeuI0Xx7B4Rl/Dk8e 0xIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KejWig8AsEIxLVrSv/J15uCwWDN/AuT/rTircRNN6JE=; b=WIFXAcTUlUx7dQ9ToISkbgoW/J3TB6ZWYAFA2tBhmudVBwu0xCXt2uDA9F9SSw/lCv xGcoC1q1tfkVNwDNDIRXwlJEGe7Mo4ne4rD2JHbn3pfTk84VSe/dVwfVTK0mLa5ngNuJ aA9pmodq+I9OXbkTJYIIxzib1F4EhNm3CqYAJTAwvNzzgTv2zCZ6UJ0pf5SP3dK4WzSl 0gRBnFu9py2ov4i4sKJPRlPA85dSQIH4ivAE+Zawp0RwKAItmNFVp/8eBnBIbl+4IerU WBmrmQpxCihNSpJagTH4J41szFFMTaZCaiJ5/CeagvN5pWoyHA+N0xQRN0QKFPCwGTZC L+Jw== X-Gm-Message-State: APjAAAWJ1YrUgbpyVz1AKAygOJFFofsvklJ4IGm5CgeKBtFSaaFzQXeC ohKFo7L4NrPaqYr3n7sS7hb6DotOVzOkw9oE0j8= X-Google-Smtp-Source: APXvYqy9Y8E4pCGTrju8z7SwEicP3W9wXOmRZ74qquJlRIEJ+d/fNWsshVL+JyZ/5GWbdh4GVg/LmuD1jKUMCyP8qJc= X-Received: by 2002:a9d:7284:: with SMTP id t4mr34543428otj.154.1562215863244; Wed, 03 Jul 2019 21:51:03 -0700 (PDT) In-Reply-To: <9b78b85d-a3c8-761f-e500-d51d4a985fa8@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::32f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:238346 Archived-At: On Wed, Jul 3, 2019 at 9:05 PM Paul Eggert 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).