count of bits in a long

Tim W Smith ts at cup.portal.com
Sat Oct 13 22:53:47 AEST 1990


These times were given in a recent post for some
68020 based Sun:

	function                   time          ratio
	hackmemmod               0.00077819824   1.821
	hackmemloop              0.00059890747   1.402
	hackmemunrolled          0.00050354004   1.179
	rmlsbsub                 0.00069808960   1.634
	rmlsbmask                0.00055313110   1.295
	testlsb                  0.00107955930   2.527
	testmsb                  0.00251007080   5.875
	testsignandshift         0.00242614750   5.679
	testeachbit              0.00254821780   5.964
	testeachbit1shl          0.00362014770   8.473
	tableshift               0.00083160400   1.946
	tableuchar               0.00042724609   1.000

Something is seriously wrong with either these numbers or that
computer.  I've tried a couple of these on my Mac II, using
Think C.  Note that 1) Apple is not noted for squeezing the
last drop of performance out of the 68020, and 2) Think C
has not stressed optimal code generation.

I get 36 usec for rmlsub on longs with all 32 bits set, 20
usec if 16 bits are set, and 5 usec of no bits are set.
Note that the Sun is getting, in the average case for rmlsub,
20 times worse performance than I am getting for the worst
case.

						Tim Smith



More information about the Comp.lang.c mailing list