From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: Using __builtin_expect (likely/unlikely macros) Date: Sat, 20 Apr 2019 12:13:03 -0700 Organization: UCLA Computer Science Department Message-ID: References: <87a7gst973.fsf@gmail.com> <875zrgt12q.fsf@gmail.com> <6919a4c8-df76-ea1e-34db-1fa62a360e5a@cs.ucla.edu> <87h8aykdod.fsf@gmail.com> <4fa7885e-8c66-c7c4-ff71-a013505863af@cs.ucla.edu> <2dfb837d-989d-c736-b6e6-b20c0e940596@cs.ucla.edu> <87o956c4n4.fsf@gmail.com> <1fbd2fca-18f0-0a90-7a45-58419a9e11ee@cs.ucla.edu> <1555450070.23658.4@yandex.ru> <66b74701-012a-902e-4a5b-6bc30efa87c0@cs.ucla.edu> <87tveu85xt.fsf@gmail.com> <86ef5wd7az.fsf@gmail.com> <9461246c-409b-15fd-943b-3d673c679870@cs.ucla.edu> <8336mcbr62.fsf@gnu.org> <45401975-175e-841e-37da-707a9344a024@cs.ucla.edu> <831s1wbqfq.fsf@gnu.org> <83wojoa8x9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="149693"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 Cc: andrewjmoreton@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 20 21:22:46 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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hHvZV-000cjC-67 for ged-emacs-devel@m.gmane.org; Sat, 20 Apr 2019 21:22:45 +0200 Original-Received: from localhost ([127.0.0.1]:44592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHvZT-0007yK-Ja for ged-emacs-devel@m.gmane.org; Sat, 20 Apr 2019 15:22:43 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hHvYR-00079n-L2 for emacs-devel@gnu.org; Sat, 20 Apr 2019 15:21:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hHvQB-0006NF-Ct for emacs-devel@gnu.org; Sat, 20 Apr 2019 15:13:08 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:39402) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hHvQ9-0006MR-Ve; Sat, 20 Apr 2019 15:13:06 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id BFC611617C9; Sat, 20 Apr 2019 12:13:04 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id nZ7E4J_rOy8Y; Sat, 20 Apr 2019 12:13:04 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id EDC37161808; Sat, 20 Apr 2019 12:13:03 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 0Qbmv-XJ18XX; Sat, 20 Apr 2019 12:13:03 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id BC19D1617C7; Sat, 20 Apr 2019 12:13:03 -0700 (PDT) In-Reply-To: <83wojoa8x9.fsf@gnu.org> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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:235712 Archived-At: Eli Zaretskii wrote: >> In this case the patch not only improved performance, it also made >> the code smaller and in my opinion more readable: the total source >> code size shrank by 1775 bytes. > I meant code in C, not the produced machine code Yes, that's what I meant too. That is, the patch made the C code shorter. > I'm not sure how do you see that the code became more readable It's more readable to me partly because the common case is shorter, e.g.: -static _Noreturn void module_abort (const char *format, ...) - ATTRIBUTE_FORMAT_PRINTF(1, 2); +static AVOID module_abort (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); and partly because the unusual case is more obviously unusual. For example, in: -static _Noreturn void +static AVOID x_connection_closed (Display *dpy, const char *error_message, bool ioerror) ... -static _Noreturn int +static _Noreturn ATTRIBUTE_COLD int x_io_error_quitter (Display *display) the x_connection_closed closed is obviously typical (it uses the now-common "AVOID"), whereas the x_io_error_quitter is obviously atypical (one normally doesn't see ATTRIBUTE_COLD in .c files), and this lets the reader more-easily see that x_io_error_quitter (a) returns 'int' and (b) never returns anything, which makes it even more of an oddball than the usual AVOID functions are.