From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Using __builtin_expect (likely/unlikely macros) Date: Tue, 16 Apr 2019 17:27:24 -0400 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> <87sguhbrof.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="10750"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Paul Eggert , emacs-devel@gnu.org To: Alex Gramiak Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 16 23:27: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.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGVcI-0002bR-9y for ged-emacs-devel@m.gmane.org; Tue, 16 Apr 2019 23:27:46 +0200 Original-Received: from localhost ([127.0.0.1]:43060 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGVcH-00053J-62 for ged-emacs-devel@m.gmane.org; Tue, 16 Apr 2019 17:27:45 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGVcA-00052w-NH for emacs-devel@gnu.org; Tue, 16 Apr 2019 17:27:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hGVc9-0000WQ-Nq for emacs-devel@gnu.org; Tue, 16 Apr 2019 17:27:38 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:39387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hGVc9-0000VO-DU for emacs-devel@gnu.org; Tue, 16 Apr 2019 17:27:37 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id x3GLROej019803; Tue, 16 Apr 2019 17:27:25 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id CA9D16AD9A; Tue, 16 Apr 2019 17:27:24 -0400 (EDT) In-Reply-To: <87sguhbrof.fsf@gmail.com> (Alex Gramiak's message of "Tue, 16 Apr 2019 14:50:40 -0600") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6526=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6526> : inlines <7053> : streams <1818860> : uri <2833281> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:235554 Archived-At: > Which again shows a slight improvement with the Cold attributes, and > still shows the hot attributes degrading performance. Perhaps I was too > overzealous with the hot tagging? I think it's pretty tricky to decide which functions should be "hot", so I'm not surprised you get worse results there: That matches the past experience with programmer-annotated likelihood ;-) For "cold" I think the meaning is pretty clear: assume this code is almost never executed which can both mean that functions that call it can be optimized under the assumption that those calls are unlikely, and at the same time spend less time optimizing the function (and move it "out of the way" to a different page). But for "hot", it's not clear whether it means "called very often" or "we spend a lot of time inside of it". E.g. it would never have occurred to me to mark redisplay_internal as "hot". Stefan