home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.object:3263 comp.lang.clos:671
- Newsgroups: comp.object,comp.lang.clos
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!mips!sdd.hp.com!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!fstop.csc.ti.com!fstop.csc.ti.com!djohnson
- From: djohnson@mtc.ti.com (Doug Johnson)
- Subject: Re: Beginner's Question - CLOS
- In-Reply-To: eric@tfs.com's message of Wed, 19 Aug 1992 21:38:18 GMT
- Message-ID: <DJOHNSON.92Aug19183847@mycroft.mtc.ti.com>
- Sender: usenet@csc.ti.com
- Nntp-Posting-Host: mycroft
- Reply-To: johnson@mycroft.mtc.ti.com (Doug Johnson)
- Organization: Texas Instruments
- References: <KERS.92Aug19111407@cdollin.hpl.hp.com> <graham.714230337@galois>
- <16u2tpINN9ad@early-bird.think.com> <1992Aug19.213818.21709@tfs.com>
- Date: Thu, 20 Aug 1992 00:38:47 GMT
- Lines: 41
-
-
-
- >But doesn't that make method dispatch very time consuming? It seems like
- >it would involve searching for the method in tables, and that the amount
- >of time consumed would depend on how many methods were in those tables and
- >how many class arguments each method had.
-
- Naive implementations are slow, sophisticated ones can be quite fast
- (by Lisp standards). Techniques like caching methods are used to
- speed up dispatch.
-
- >In C++, method dispatch is trivial to the CPU, such that on most modern
- >CPU's it would take a fraction of a microsecond. I can see the advantages
- >of dispatching according to the types of multiple arguments, but I'm just
- >wondering how much of a speed impact it has. In C++ the same functionality
- >requires more code, but it seems like it would still be faster.
-
- Lisp has always tended to buy richness of expression with speed. "In
- C++ the same functionality requires more code, but it seems like it
- would still be faster" implies that programmer time is cheaper than
- CPU time. It varies from case to case, but it is often a poor
- trade to increase code to increase speed.
-
- >For
- >example, a terminal object's display function would take a base class of data
- >as its argument, and then it would get the data converted to its requirement
- >by invoking a conversion method on the data object. That conversion method
- >would be known to the terminal object at compile time, so the resulting code
- >would involve no lookups other than the initial sub-microsecond dispatch to
- >the terminal object's display function, followed by the sub-microsecond
- >dispatch to the data objects's conversion function for that terminal object's
- >data format.
-
- In general, EVERYTHING in Lisp is deferred to runtime. Richer
- expression at the cost of performance. CLOS is entirely consistent
- with Lisp philosophy. C++ is entirely consistent with C. Both have
- their virtues. Neither solves all the world's problems, no matter
- what the bigots say.
-
- Doug Johnson
- Lisp Bigot (retired)
-