[comp.sys.intel] Using short ints

frank@rsoft.UUCP (Frank I. Reiter) (01/11/89)

We've recently ported a bunch of SCO Xenix 286 C code to SCO Xenix 386.  Can
someone familiar with 80386 assembler tell me whether there is any performance
benefit in using short ints (16 bits) rather than the default 32 bit ints for
things like array subscripts, loop counters etc.

Thanks in advance!
-- 
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Frank I. Reiter             \ /    UUCP:    {uunet,ubc-cs}!van-bc!rsoft!frank
Langley, British Columbia   / \     BBS:    Mind Link @ (604)533-2312
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*

davidsen@steinmetz.ge.com (William E. Davidsen Jr) (01/12/89)

Here's some info from my benchmarks file. It indicates that the use of
shorts might buy you a few percent, but I wouldn't write any code using
it. This doesn't show converting the short to int every time it's used
as a subscript, passed as an argument, or used in a calculation.

I'd save short for places where you need to save space...
________________________________________________________________

System id: GV386+287, 1MB 16MHz+cache

Optimized math results:

Math operations, effective instructions/sec (thousands)

               Add     Sub     Mpy     Div    Wtd. Avg.
short:      1973.7  1973.7   843.4   493.8    1469.1
long:       1973.7  1948.1   789.5   329.7    1423.4
float:        45.2    44.4    39.8    22.5      40.2
double:       41.5    41.0    28.2    21.6      35.0
int:        1975.3  1948.1   789.5   329.7    1423.8
-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me