From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: [PATCH] First batch of numerics changes Date: Sun, 30 Jan 2011 11:33:35 -0500 Message-ID: <87fwsa1hcw.fsf@yeeloong.netris.org> References: <87lj2762xc.fsf@yeeloong.netris.org> <87tygv4726.fsf@yeeloong.netris.org> <87wrlo2k9z.fsf@yeeloong.netris.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1296405231 4305 80.91.229.12 (30 Jan 2011 16:33:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 30 Jan 2011 16:33:51 +0000 (UTC) Cc: guile-devel@gnu.org To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Jan 30 17:33:47 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PjaDi-0006aK-Kc for guile-devel@m.gmane.org; Sun, 30 Jan 2011 17:33:46 +0100 Original-Received: from localhost ([127.0.0.1]:37415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjaDi-0004Qk-1R for guile-devel@m.gmane.org; Sun, 30 Jan 2011 11:33:46 -0500 Original-Received: from [140.186.70.92] (port=47989 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjaDf-0004Qb-IU for guile-devel@gnu.org; Sun, 30 Jan 2011 11:33:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PjaDe-0007LD-5U for guile-devel@gnu.org; Sun, 30 Jan 2011 11:33:43 -0500 Original-Received: from world.peace.net ([216.204.32.208]:38335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PjaDe-0007L9-12 for guile-devel@gnu.org; Sun, 30 Jan 2011 11:33:42 -0500 Original-Received: from ip68-9-118-38.ri.ri.cox.net ([68.9.118.38] helo=freedomincluded) by world.peace.net with esmtpa (Exim 4.69) (envelope-from ) id 1PjaDZ-0005X4-J8; Sun, 30 Jan 2011 11:33:37 -0500 Original-Received: from mhw by freedomincluded with local (Exim 4.69) (envelope-from ) id 1PjaDX-0006it-UH; Sun, 30 Jan 2011 11:33:35 -0500 In-Reply-To: (Andy Wingo's message of "Sun, 30 Jan 2011 13:12:06 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 216.204.32.208 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11434 Archived-At: Andy Wingo writes: > On Sat 29 Jan 2011 09:20, Mark H Weaver writes: > >> @@ -728,7 +728,7 @@ SCM_PRIMITIVE_GENERIC (scm_abs, "abs", 1, 0, 0, >> "Return the absolute value of @var{x}.") >> #define FUNC_NAME >> { >> - if (SCM_I_INUMP (x)) >> + if (SCM_LIKELY (SCM_I_INUMP (x))) >> { >> scm_t_inum xx = SCM_I_INUM (x); >> if (xx >= 0) > > Is this really likely the case? Probably not. I'm going to hold off on > this patch, unless you really want it in. Well, my thinking there was that floating-point operations in Guile are probably very slow anyway, since they require heap allocations (right?), so a few mispredicted branches are probably not going to make much difference there. I felt that the fixnum case should get the fast path. However, you may be right that abs(x) is rarely used on exact integers. I just submitted a new version of this patch with that hunk skipped. Thanks! Mark