From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: Remove useless if-before-free and if-before-xfree tests Date: Tue, 30 Jun 2009 08:43:58 +0900 Message-ID: <871vp2y5a9.fsf@uwakimon.sk.tsukuba.ac.jp> References: <87d48nvc6k.fsf@meyering.net> <87r5x3lbo6.fsf@kfs-lx.rd.rdm> <87fxdjtqfo.fsf@meyering.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1246319063 19892 80.91.229.12 (29 Jun 2009 23:44:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Jun 2009 23:44:23 +0000 (UTC) Cc: Emacs development discussions , "Kim F. Storm" To: Jim Meyering Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 30 01:44:16 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MLQWF-0003HA-Jl for ged-emacs-devel@m.gmane.org; Tue, 30 Jun 2009 01:44:15 +0200 Original-Received: from localhost ([127.0.0.1]:48227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLQWF-0007YW-39 for ged-emacs-devel@m.gmane.org; Mon, 29 Jun 2009 19:44:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MLQWB-0007YH-ID for emacs-devel@gnu.org; Mon, 29 Jun 2009 19:44:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MLQW6-0007Y5-6y for emacs-devel@gnu.org; Mon, 29 Jun 2009 19:44:10 -0400 Original-Received: from [199.232.76.173] (port=37943 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLQW6-0007Y2-0O for emacs-devel@gnu.org; Mon, 29 Jun 2009 19:44:06 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:54218) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MLQW5-0005UH-Dw for emacs-devel@gnu.org; Mon, 29 Jun 2009 19:44:05 -0400 Original-Received: from mtps01.sk.tsukuba.ac.jp ([130.158.97.223]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MLQW4-0001fT-Iq for emacs-devel@gnu.org; Mon, 29 Jun 2009 19:44:04 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mtps01.sk.tsukuba.ac.jp (Postfix) with ESMTP id BB8EC1535B3; Tue, 30 Jun 2009 08:43:52 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 2D57412827C; Tue, 30 Jun 2009 08:43:58 +0900 (JST) In-Reply-To: <87fxdjtqfo.fsf@meyering.net> X-Mailer: VM 8.0.12-devo-585 under 21.5 (beta29) "garbanzo" 5bbff3553494 XEmacs Lucid (x86_64-unknown-linux) X-Detected-Operating-System: by mx20.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:111821 Archived-At: Jim Meyering writes: > Kim F. Storm wrote: > > Jim Meyering writes: > >> I removed a bunch of these last year. > >> Since then, a few have snuck back in, so here's another round. > >> I've just committed the following two change sets: > > > > I haven't looked specifically at the changes, but a test before xfree > > may not be useless performance-wise if the normal case is "ptr is NULL". These "normally NULL" cases are likely only in "last chance" cleanup, which should be outside the loop. > Hi Kim, > > If adding that extra "if" test-before-free leads to a measurable > performance improvement, please let me know. I've removed hundreds > of such tests in many projects, and so far no one has taken the time > (or been able?) to demonstrate such a thing. > > Besides, even if there is a measurable performance difference, in my book, > the cleaner code trumps what can only be a negligible performance hit. "inline" is your friend. If you don't trust GCC (and on this kind of thing, who does? :-), you can force xfree to inline the test by defining it as a macro.