Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site iuvax.UUCP
Path: utzoo!linus!decvax!harpo!ihnp4!inuxc!iuvax!saj
From: saj@iuvax.UUCP
Newsgroups: net.lang
Subject: Re: Self-modifying code - (nf)
Message-ID: <116@iuvax.UUCP>
Date: Wed, 15-Feb-84 15:10:35 EST
Article-I.D.: iuvax.116
Posted: Wed Feb 15 15:10:35 1984
Date-Received: Thu, 16-Feb-84 06:06:29 EST
Sender: saj@iuvax.UUCP
Organization: Indiana U, Bloomington
Lines: 19

#R:fortune:-215700:iuvax:11800008:000:684
iuvax!apratt    Jan  8 00:38:00 1984

I found another use for self-modifying code: speed.  I wrote a graphics
package (a pretty simple-minded one) for the IBM PC, and found that my
line-drawing routine had two spots where one of three things needed doing:
	increment x (or y),
	decrement x (or y),
	do nothing to x (or y).

	I could have loaded the proper add-on value (-1, 0, or 1) into a
memory location or register and used an add instruction, but it was MUCH
faster to have the program "poke" an increment, decrement, or NOP instruction
into the appropriate spot. One (inprecise) comparison (timed with a watch)
showed a 20% speed increase (approx. 4 seconds in 20).
							-- Allan Pratt
						...ihnp4!iuvax!apratt