🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #3391

Re: Lisp/C Wars

#3391
From: Steve Olson
Date: Sat, 06 Apr 1991 06:34
34 lines
2478 bytes
   !! I'm very surprised.  Scheme's optimizer must be really good.  Or does scheme
   have simpler arrays (statically typed ones) than common lisp?

Common Lisp has extensive facilities for declaring array types.  With the 
appropriate declarations an optimizing Common Lisp compiler can do quite well
with simple array references.

   I suppose lisp compilers are much more global than those of other languages.
   They must detect that an object will only ever be assigned one data type and
   then make that object static instead of dynamic.

No, thats not how Lisp compilers work.  I doubt that any Lisp compiler would
try to infer the types of random global variables.  The optimizing Lisp 
compiler that I am familiar with (Lucid) does not even try to optimize local
variables in that manner.  What it will do is infer the types of some 
intermediate values.  If a,b, and c are declared float then then compiler
wll fully optimize the expression "(+ a (+ b c))" by inferring the type
of the intermediate expression "(+ b c)".  It won't even do that much if 
a, b, and c are fixnums.  "(+ b c)" could evaluate to a bignum, so you have
to promise that that won't happen by doing "(+ a (the fixnum (+ b c)))".

   Oh that reminds me, when the above optimization is done, how are bignums
   handled?  I can see how the compiler might detect that only integers
   are involved, but how does it know that the integers will be small?  Or is
   there always runtime code for checking integer sizes?

If you promise that a variable is a fixnum then the compiler (at high levels
of optimization) will produce code that does not check for overflows.  If 
you're wrong about your promise then you lose.

- Steve Olson
  MIT Lincoln Laboratory
  olson@juliet.ll.mit.edu
Technical Details
Message-ID: <OLSON.91Apr6013453@lear.juliet.ll.mit.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!ub!uhura.cc.rochester.edu!rochester!cornell!uw-beaver!mit-eddie!xn.ll.mit.edu!xn!olson
References: <1991Apr4.075558.19873@sbcs.sunysb.edu> <MARKF.91Apr4104859@montreux.ai.mit.edu> <1991Apr5.203141.8032@sbcs.sunysb.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!ub!uhura.cc.rochester.edu!rochester!cornell!uw-beaver!mit-eddie!xn.ll.mit.edu!xn!olson
From: olson@lear.juliet.ll.mit.edu ( Steve Olson)
Newsgroups: comp.lang.misc
Subject: Re: Lisp/C Wars
Message-ID: <OLSON.91Apr6013453@lear.juliet.ll.mit.edu>
Date: 6 Apr 91 06:34:53 GMT
References: <1991Apr4.075558.19873@sbcs.sunysb.edu>
 <MARKF.91Apr4104859@montreux.ai.mit.edu>
 <1991Apr5.203141.8032@sbcs.sunysb.edu>
Sender: usenet@xn.ll.mit.edu
Organization: M.I.T. Lincoln Lab - Group 43
Lines: 34
In-Reply-To: jallen@csserv1.ic.sunysb.edu's message of 5 Apr 91 20:31:41 GMT