Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jun 2000 16:58:38 -0700
From:      Alfred Perlstein <bright@wintelcom.net>
To:        "Daniel C. Sobral" <dcs@newsguy.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Optimization
Message-ID:  <20000605165838.W17973@fw.wintelcom.net>
In-Reply-To: <200006052347.IAA00583@daniel.sobral>; from dcs@newsguy.com on Tue, Jun 06, 2000 at 08:47:42AM %2B0900
References:  <200006052347.IAA00583@daniel.sobral>

next in thread | previous in thread | raw e-mail | index | archive | help
* Daniel C. Sobral <dcs@newsguy.com> [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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000605165838.W17973>