Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: net.arch Subject: Re: Self-modifying code Message-ID: <6516@utzoo.UUCP> Date: Sat, 15-Mar-86 21:00:33 EST Article-I.D.: utzoo.6516 Posted: Sat Mar 15 21:00:33 1986 Date-Received: Sat, 15-Mar-86 21:00:33 EST References: <546@tekcrl.UUCP> <5100019@ccvaxa>, <4254@dartvax.UUCP> Organization: U of Toronto Zoology Lines: 19 > > For some specific instance of a general routine with all sorts of > > ifs depending on parameters values, take a general prototype with all > > the ifs in it, compile only the parts you need into a buffer, and then > > execute that buffer. > > How does this differ (conceptually) from invoking a subroutine which has > its own local memory and passing it parameters? Conceptually, not at all. Practically, quite a bit. Making choices during compilation is generally faster than making them at run time. If the code is going to be used enough to justify the compilation overhead, compiling will be a considerable win. It also gives you access to a huge number of different alternatives without having to write, compile, and store all of them in advance. (If you don't think this is significant, try enumerating the different cases of something like an efficient BitBlt implementation. Thousands of different code sequences.) -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry