home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!agate!peoplesparc.Berkeley.EDU!fateman
- From: fateman@peoplesparc.Berkeley.EDU (Richard Fateman)
- Newsgroups: sci.math.symbolic
- Subject: Computer Algebra languages slow (was:Re: "shut up and deal the cards")
- Date: 25 Dec 1992 19:52:35 GMT
- Organization: University of California, Berkeley
- Lines: 45
- Message-ID: <1hfoq3INN68i@agate.berkeley.edu>
- References: <Bzs70r.B1B@news.cso.uiuc.edu> <1992Dec25.001234.21234@u.washington.edu>
- NNTP-Posting-Host: peoplesparc.berkeley.edu
-
- In article <1992Dec25.001234.21234@u.washington.edu> petry@zermelo.math.washington.edu (David Petry) writes:
- >I gather
- >that good Mathematica programmers must learn a bunch of slick tricks to
- >write reasonably efficient programs. That bothers me.
- >
- >Does anyone have any comments?
-
- In a type-less language, a construction such as x:=x+1 (or x++) has to be
- fairly general. For example, x may be a symbolic expression, and adding
- 1 to it may be fairly expensive.
- Other expensive operations include comparison, arbitrary-precision
- integer or floating-point arithmetic, etc. Even when these features are
- not used, the interpreter has to be prepared to check this possibility.
- (Some interpreters are, nevertheless, faster than others (e.g. compare
- Maple to Mathematica -- Maple is, I suspect, much faster. It also has
- a much simpler evaluation mechanism.)
-
- In any interpreter-language, there is an inherent disadvantage to programming
- "in the small". Some of this disadvantage can be overcome by using types
- (at least sometimes) as is possible in Lisp, and compiling.
-
- Some well-known languages, by making type
- declarations required all the time, inhibit some kinds of expressiveness
- (there may be arguments on this point), but that's my current opinion.
-
- Another way around this is to promote (as in Mathematica), high-level
- transactions that do type-checking once, and then use those types for
- the remainder of the operation. For example, creating a Table with
- the index computation type-checked but once. If there is a bad fit
- between the provided high-level commands and the needs of the algorithm,
- that's too bad.
-
- Finding the good fit, if there is one, is what Mr. Petry calls a trick,
- and it is inherent in Mathematica's approach to efficiency in the
- user language.
-
-
-
-
-
-
-
- --
- Richard J. Fateman
- fateman@cs.berkeley.edu 510 642-1879
-