April 17, 2002
Optimization

"I regret every single declaration I've made in the past seven years of Lisp programming." -- Me.

(Your mileage may vary. Does not include ignore, ignoreable, or notinline declarations. Historical performance does not insure future performance. Otherwise, it's true.)

Posted by jjwiseman at April 17, 2002 05:58 PM
Comments

Yeah, me too.

Partly because writing in Lisp frees me from thinking about types all of the time.

Partly because the Lisp compilers can't reasonably optimize because on type specifications.

Posted by: Will Fitzgerald on April 18, 2002 06:42 AM

I think sometimes people come to Lisp knowing only C or Java, and when they discover how to declare things in Lisp, they think they *should* declare things. When really, most lisp programmers don't.

As an aside, this is one thing that turns me off about the code in CLOCC (http://clocc.sourceforge.net/); it is filled with declarations like

(declare (pathname root) (stream out))

that seem worse than useless to me. There's just no way that declaration is going to speed anything up. The best you can hope for is that a particular implementation might turn those into assertions, but since the standard doesn't guarantee it, why not make them assertions in the first place:

(check-type root pathname)
(check-type out stream)

Though I don't think even that is normally worth doing. In this example, what about allowing pathname designators and stream designators?

Certainly the type of programming you're doing is relevant; Declarations can be a huge win in heavily numeric code.

(Also, Dan Barlow reminded my of (declare (special ...)), which I should have included in my disclaimer.)

Posted by: jjwiseman on April 19, 2002 11:02 AM

I have to disagree with Will. I just tried the ACL demo, and
it was able to generate C-grade code on my first try at
using declarations (after not having touched Lisp for
years :)

Posted by: Eric on May 11, 2002 08:09 PM
Post a comment
Name:


Email Address:


URL:




Unless you answer this question, your comment will be classified as spam and will not be posted.
(I'll give you a hint: the answer is “lisp”.)

Comments:


Remember info?