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

Re: Test of mailing list; Lisp-to-C conversion line conversion



  Date: Fri 23 Apr 93 15:34:36-PDT
  From: Mabry Tyson <TYSON@ai.sri.com>
  Subject: Test of mailing list; Lisp-to-C conversion line conversion
  To: XSLUG@ai.sri.com, XCOMMON-LISP@ai.sri.com
  Mail-System-Version: <SUN-MM(229)+TOPSLIB(128)@AI.SRI.COM>
  
  We are going to be a subcontractor on a proposal with another company.  The
  prime contractor will be converting our Common-Lisp code to C.  Their pricing
  to the client will be based on the number of C lines they expect to "write".
  
  Does anyone have any empirical data on lines of Lisp to lines of C  (yes, I
  know it is *extremely* variable -- eg, whether we need a GC)?   Also, does
  anyone have any data on the relative cost of those lines compared to lines
  of C written from scratch?
  
  -------

Here's some ideas that might provide a crude estimate.  You probably don't
want to use these factors without thinking about them, or doing a micro
conversion.  For the code in your Lisp application:

Factor  x  each line of
2          Class or structure definition
            1 line for the .c file, one for the .h file.

1.5         Function or method
              1 for the line of code , + a bit for any declarations, + a
              bit since method dispatch must be hand coded.

To this add

Factor  x  Number of 
1          :Reader or :Writer methods
1          Generic function.


You will need to add an estimate for a C++ "library" that provides the
pieces of Lisp you want, like lists and GC...  you can get estimates from
sizes of existing libraries, such as NIHCL.  Reference counting (yuk) GC's
are commonly described (see a book called "Advanced C++ programming").
While a GC scheme may increase the number of lines in a class definition,
it wouldn't shouldn't add to the rest of the code.  If you are going to use
(rather than write) a class library, estimate an "interface" to it of say
10 to 20% of its size.

This doesn't say anything about user interfaces.  If you were going from
dynamic windows to X, you might do something like add 1 line for each
keyword argument in a function call, or something.

Hope this helps.