From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jim Meyering Newsgroups: gmane.emacs.devel Subject: Re: Remove useless if-before-free and if-before-xfree tests Date: Mon, 29 Jun 2009 10:06:03 +0200 Message-ID: <87fxdjtqfo.fsf@meyering.net> References: <87d48nvc6k.fsf@meyering.net> <87r5x3lbo6.fsf@kfs-lx.rd.rdm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1246262969 3508 80.91.229.12 (29 Jun 2009 08:09:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Jun 2009 08:09:29 +0000 (UTC) Cc: Emacs development discussions To: storm@cua.dk (Kim F. Storm) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 29 10:09:22 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 1MLBvV-0005jA-Sy for ged-emacs-devel@m.gmane.org; Mon, 29 Jun 2009 10:09:22 +0200 Original-Received: from localhost ([127.0.0.1]:49759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLBvV-0000m1-0G for ged-emacs-devel@m.gmane.org; Mon, 29 Jun 2009 04:09:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MLBsV-0006sh-7A for emacs-devel@gnu.org; Mon, 29 Jun 2009 04:06:15 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MLBsQ-0006ku-GD for emacs-devel@gnu.org; Mon, 29 Jun 2009 04:06:14 -0400 Original-Received: from [199.232.76.173] (port=56486 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLBsQ-0006ka-7Z for emacs-devel@gnu.org; Mon, 29 Jun 2009 04:06:10 -0400 Original-Received: from smtp3-g21.free.fr ([212.27.42.3]:50547) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MLBsP-0005UE-Dc for emacs-devel@gnu.org; Mon, 29 Jun 2009 04:06:10 -0400 Original-Received: from smtp3-g21.free.fr (localhost [127.0.0.1]) by smtp3-g21.free.fr (Postfix) with ESMTP id 631AB8180E5 for ; Mon, 29 Jun 2009 10:06:05 +0200 (CEST) Original-Received: from mx.meyering.net (mx.meyering.net [82.230.74.64]) by smtp3-g21.free.fr (Postfix) with ESMTP id 7FA258181AE for ; Mon, 29 Jun 2009 10:06:03 +0200 (CEST) Original-Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 650B1385A8; Mon, 29 Jun 2009 10:06:03 +0200 (CEST) In-Reply-To: <87r5x3lbo6.fsf@kfs-lx.rd.rdm> (Kim F. Storm's message of "Mon, 29 Jun 2009 09:52:09 +0200") Original-Lines: 18 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) 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:111805 Archived-At: 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". 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.