Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site clan.UUCP Path: utzoo!dciem!nrcaero!clan!holtz From: holtz@clan.UUCP (Neal Holtz) Newsgroups: net.ai Subject: Re: Compiled versus interpreted LISP Message-ID: <125@clan.UUCP> Date: Mon, 22-Oct-84 09:03:27 EDT Article-I.D.: clan.125 Posted: Mon Oct 22 09:03:27 1984 Date-Received: Tue, 23-Oct-84 07:40:54 EDT References: <63@water.UUCP> Organization: Systems Eng., Carleton Univ., Ottawa, Canada Lines: 61 *************************************** Does compiling speed up lisp? Immensely (usually). In most cases you should expect 5 or 10 to one. Some tests I just did yesterday (on an Apollo DN660 with a compiler not quite as good as it could be (compiled code should run about twice as fast as it does)). 1. a couple of old standbys: (de fact (n) (cond ((lessp n 1) 1) (t (times n (fact (sub1 n))) ) )) (fact 200) Interpreted: 10.9s Compiled: 9.7s Speedup: 1.1 Most of the time is spent in bignum arith, so compiling has very little effect on this one. Also, don't use this as a comparison with other machines. I think the bignum package needs work. 2. (de fib (n) (cond ((izerop n) 0) ((ionep n) 1) (t (iplus (fib (sub1 n)) (fib (sub1 (sub1 n))) )) )) (fib 15) Interpreted: 8.3 sec. Compiled: 0.097 sec. Speedup: 86 to 1 This includes an overhead of about 0.05 sec. for read-print. Subtract that and you get about a 175 to 1 speed up. 3. A little bit more meaningful - a simple "prolog" unifier essentially as given in "LOGLISP: an alternative to Prolog" by Robinson & Sibert, Syracuse U. (about 1 page of code, I can send it if you are interested). 500 executions of: (unify '($foo x (y z)) '(y x ($foo $bar)) ) [atoms beginning in "$" are variables] Interpreted: 311 sec. (including 12 - 700K garbage collections) Compiled: 0.737 sec. Speedup: 422 to 1 In this one, there was a *LOT* of macro expansion going on, and the expansions were not destructive. On could assume a substantial speed up in the interpreter if expanded macros displaced original code. Neal Holtz Dept. of Civil Engineering Carleton University Ottawa ...!utcsrgv!nrcaero!clan!holtz