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 20:58:22 +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> <83k1cybk8c.fsf@gnu.org> <83ef36ar0p.fsf@gnu.org> 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="117581"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Paul Eggert , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 04 22:59:47 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 1hj8pW-000UTT-MJ for ged-emacs-devel@m.gmane.org; Thu, 04 Jul 2019 22:59:46 +0200 Original-Received: from localhost ([::1]:48772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hj8pV-0004gB-NB for ged-emacs-devel@m.gmane.org; Thu, 04 Jul 2019 16:59:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52870) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hj8oy-0004Y4-1W for emacs-devel@gnu.org; Thu, 04 Jul 2019 16:59:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hj8ov-0003cV-Tc for emacs-devel@gnu.org; Thu, 04 Jul 2019 16:59:11 -0400 Original-Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:44121) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hj8ot-0003bS-Ur; Thu, 04 Jul 2019 16:59:08 -0400 Original-Received: by mail-ot1-x334.google.com with SMTP id b7so7008244otl.11; Thu, 04 Jul 2019 13:59:07 -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=f0rnKs/3Wg1JYXHvn/yB/CISw/IPTGSiq5DBDD0/stk=; b=FOgc3UvDGSB4hkzVds+IzeIinpgQYKydIAGkFp5f1zcuj9ULMIc/2hVzx2WQPkxVfm 9Mn+/g16ane3DC5lCBXO7m1O4Mmm8CnQSHP/bFx+N1/+YYyhyytXPYy85J8U7pzVkK6M 9RF4WtAx/U+CAB04j1LF698IlkteEynuLc6MmuW5n3GHcQbzf0DR9Ld/MreEEzVHZ9CG D/zQENUKNuTmg2xKd7i3udmlCcnVTUI1r+esbPeiDK+yn5c5NGQTQ82wytrOG2L6NT5y txK5RzZ2nl68da9vCtGftq6AY0YK3c7SL/i2NSPXy/0/uWW/Vuk0Cpvc6TsPzXnf2NRa h4BA== 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=f0rnKs/3Wg1JYXHvn/yB/CISw/IPTGSiq5DBDD0/stk=; b=stGkz/qMCjUcjCe0d1Qw6oaq361zZ2f0epM/1ufBnrZXZTTcpD67VAff5M08zGce+s ISNKv+em8XcuMLQybr62fLpXtqOdu7x617m+UDzMnKeV6Kut6htuua75LWr7mW2jeuk4 SOt+O+3uyDCc28QwwKn+EHY2idfx0Anm3QbBZMsMTCAqBnO9fuoogY1J25vg7NIpYn9e 4ZMAZfmiXH7+pH+xoKzDcq+72Rz3j2lcZfbgywWFftUXSaHObeQF4pFn2Y/IRqpsV11o UBtisc94yk4tFsgehWUaJoEft7NDOa+8xb+6CJLo1QQoqIY2g46lFeVwSf+LYkuwFbWj Hjyw== X-Gm-Message-State: APjAAAUEk4CBwdRxzrHkri4I8G0Bi9AMXCXMCprFd542dP8EOSPdMmQR Bp5y4WUQ0sP2vi9zL1os/ZM8UvyuZr3VbS3cmp4ozm1L X-Google-Smtp-Source: APXvYqzm5uSDrYlNMlMnLPohbUPAwXXnJHjS6HVtKEx/0/jbRyYHusKITB6RnqR3+DqpUucjQZ7UXXPfx8UC0qOWwnI= X-Received: by 2002:a9d:7284:: with SMTP id t4mr12849otj.154.1562273946977; Thu, 04 Jul 2019 13:59:06 -0700 (PDT) In-Reply-To: <83ef36ar0p.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::334 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:238362 Archived-At: On Thu, Jul 4, 2019 at 1:06 PM Eli Zaretskii wrote: > > Cc: pipcet@gmail.com, emacs-devel@gnu.org > > From: Paul Eggert > > Date: Thu, 4 Jul 2019 00:15:12 -0700 > > > > 1030-lnxsrv09 $ time ./a.out 0 0 > > > > real 0m51.933s > > user 0m51.927s > > sys 0m0.001s > > 1031-lnxsrv09 $ time ./a.out 0 0 0 > > > > real 2m16.960s > > user 2m16.960s > > sys 0m0.000s > > 1032-lnxsrv09 $ time ./a.out 0 0 0 0 > > > > real 0m59.678s > > user 0m59.677s > > sys 0m0.001s > > Thanks. I'm seeing a much smaller slowdown with "perf stat": 12.3 cycles/loop rather than 11.7. > > This indicates that on this !USE_LSB platform, the EQ+make_fixnum code is about > > ten times faster than the FIXNUMP+XFIXNUM code on this benchmark. > > You mean twice faster (~2m vs ~1m), right? "g" is 8 seconds slower than "noop", but "f" is 76 seconds slower. > > I'm not surprised by the performance disparity, as branch-prediction > > failures can be pretty expensive. Do you really see mispredicted branches in this simple example? I'm surprised. I'm seeing a single branch in "f", which is well-predicted as it alternates between being taken and not being taken. > Which indeed means that if the object is not guaranteed to be a > fixnum, using XFIXNUM is generally suboptimal. XFIXNUM is half a clock cycle more expensive, maybe, in non-equivalent code, on a peculiar platform. That's hardly "generally". (It is a pity that gcc doesn't optimize bit field comparisons very well, so we have to resort to the ((x-c) & mask) == 0 construction in TAGGEDP. Maybe we could make it better by throwing in some eassumes, but really gcc needs to recognize (x-c) & mask == 0 as equivalent to (x & mask) == c (in the right conditions) and emit whichever variant is faster.) I think it would make most sense to introduce a macro for comparing a Lisp object to a C integer, which does the right thing even outside the fixnum range. Slower, but it would reduce our dependencies on the fixnum range being large enough to hold all practical integers.