From owner-freebsd-hackers Mon Jun 5 16:58:44 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 69B6437BE32 for ; Mon, 5 Jun 2000 16:58:39 -0700 (PDT) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e55Nwc302944; Mon, 5 Jun 2000 16:58:38 -0700 (PDT) Date: Mon, 5 Jun 2000 16:58:38 -0700 From: Alfred Perlstein To: "Daniel C. Sobral" Cc: hackers@FreeBSD.ORG Subject: Re: Optimization Message-ID: <20000605165838.W17973@fw.wintelcom.net> References: <200006052347.IAA00583@daniel.sobral> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: <200006052347.IAA00583@daniel.sobral>; from dcs@newsguy.com on Tue, Jun 06, 2000 at 08:47:42AM +0900 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Daniel C. Sobral [000605 16:47] wrote: > Can someone discuss the performance trade-offs of the following two > alternative codes (and maybe suggest alternatives)? > > Problem: I need to retrieve two values from a table. > > Alternative A: > > x = table[i].x; > y = table[i].y; > > Alternative B: > > d = table[i]; > x = d & MASK; > y = d >> SHIFT; x = table[i]; y = x >> SHIFT; x &= MASK; ? I would run gcc -O3 -S on the code on several archs and see what comes up. -Alfred To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message