[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lisp/Genera advantages over C (plea for help)



  Date: Fri, 2 Mar 90 10:20 EST
  From: GODDEN%gmr.com@relay.cs.net
  Subject: Lisp/Genera advantages over C (plea for help)
  To: slug@warbucks.ai.sri.com
  X-VMS-To: NET%"slug@warbucks.ai.sri.com"
  
  I am preaching for the use of Common Lisp/CLOS in a new project here,
  while every one else in the group prefers C.  The reasons for C are:
  1. runs on UNIX boxes
  2. is portable
  3. offers better performance than Lisp.
  
  I am claiming that CL satisfies both 1 and 2; and I'm rejecting 3
  altogether.  I'm basing that rejection on statements such as at the
  bottom of p.2 in CLtL (to wit: there are Lisp compilers that produce
  numerical code on a par with Fortran compilers), and there are
  known techniques for optimizing Lisp programs and compilers (e.g. 
  use of macros, avoidance of consing, tail-recursion optimizations).  

It is hard to keep religion out of such a discussion, but let me try.
I believe the statement in CLtL is true.  By using type declarations
carefully, numerical code should be efficient.  It would be
interesting to compare some numerical algorithm in both C and LISP.
On LISPM, i have found it useful to recode generic functions like EXP
for the particular case (single-float) that i was interested in to
avoid type checking, type conversion, and funcalling.

Needless consing can be avoided, just as it can be in C.  In C, of
course, you have to do GC yourself.

I don't believe C optimizes tail-recursion, though you can hand code
it. 
  
  A counter-argument I have just encountered is the observation that
  some (many) AI vendors have converted their code from Lisp to C
  'for performance'.  My response is that such moves constitue wise
  marketing because MIS managers have never heard of Lisp, or have
  heard that it's a performance dog.  Rather than fight the world,
  the vendors figure it's easier to give them what they want (C),
  and tell them what they want to hear (Lisp is a dog).  Perhaps
  I'm wrong, and the vendors provide C for sound technical reasons.
  Can anyone enlighten me further on this point (i.e. give me some
  ammo).  Naturally, my most significant argument is that CL and
  Genera will offer us superior productivity.  But that is one issue
  of several, and I need to meet the opposition on their own turf.
  -Kurt Godden
   godden@gmr.com

I'll list some more issues to think about:

o Do people know C and LISP?  If they don't are they willing to learn? 
  
o How big is your application to be.  If it is small, that favors C.

o If your application is in LISP, are there additional licensing issues
  that make LISP less attractive?

o Some AI vendors may have had already prototyped their software in
  LISP and had several years of experience with it.  Then, it might be
  relatively easy to convert to C.

o Doing an AI system from scratch in C, might be hard because you have
  to lay a lot of groundwork that LISP provides before you get started
  in C.  What features of LISP does your system needed?  How would you
  implement them in C?  How long would it take?

o Do you need CLOS? If you use C, is C++ an alternative?  
  
o What do you expect the history of the system to be?  Will it evolve
  over time, or be relatively fixed?  
  
o As i believe Ken Forbus once said, you can write something in any
  language, i'ts just how much are you prepared to sweat.  If you
  start in C, you sweat up front.  If you start in LISP you can get
  things going quickly, and can face the perfomance issues as you go
  along.

k