[net.unix-wizar] register variables

CSvax:Physics:suitti (11/05/82)

#R:sri-unix:-404200:pur-phy:12700003:000:1574
pur-phy!suitti    Nov  4 16:59:00 1982

	I've found (by looking at the code produced by C, and timing,
an profiling) that you want to make anything that can be made register
a register on an 11.  (I use an 11/44).  However, there are only three
register variables that a subroutine can use.  The choice, then, must
be made as to which variables should be made register.  The following
are hints:
	1.	The most often refered to.  A cross-ref prog like cxrf
		will tell you that.
	2.	The most often used.  Is the program likely to sit in
		one particular loop for 80% of it's time?
	3.	If two variables are used the same amount, and one is
		a pointer and the other is an int (for being used in
		math), then usually the pointer will save you more.  I
		don't off-hand remember why this was true.  It was probably
		dependant on the code you were trying to get to execute.
	4.	Use experimental means:  Try it many ways.  Use lastcomm
		to tell you the total time.  Use profileing to tell you
		what should be optimized.  Look at the assembly output
		to see what swill (Ooops, I mean code, I don't want to
		hurt the feelings of any compilers out there) that was
		produced.
	5.	If you really want it fast, hand optimize the AS output.
		This is seldom worthwhile.  I find it only gaurentees
		saving you 10%.  I have gotten a factor of two in cases
		where removing csv, cret from subroutines that did not,
		on the average, execute many instructions.  What makes
		it so un-worthwhile is when minor mods must be made to
		your prog.
				(Not afraid to optimize my name)
				steve uitti
				...pur-ee!pur-phy:suitti