Benefits of moving from Python to Common Lisp?
Tim Bradshaw
tfb+google at tfeb.org
Thu Nov 15 06:52:42 EST 2001
Paul Rubin <phr-n2001d at nightsong.com> wrote in message news:<7xy9l9ne1b.fsf at ruckus.brouhaha.com>...
>
> However, most Lisp compilers have depended on type declaration pragmas
> to generate good code, AFAIK. Python would need a language extension
> to support something like that.
I don't think this is really true for many interesting programs. It
is very definitely true for *some* kinds of programs, for instance
things that do heavy numerical work, and almost all of the trivial,
stupid, non-benchmarks that people use to decide that `language x is
faster than language y' so they can flame on inappropriate newsgroups
(cll readers will be familiar with this).
However a lot of programs spend a lot of time doing stuff where the
typechecking overhead seems to be in the noise. Anything that's
building and manipulating large complex data structures is probably
spending a lot of its time chasing pointers and worrying much more
about cache misses and so on than exact details of types.
As an example, I have a system (in Lisp) which parses structures from
a stream, amd then does various manipulations on them. It has
bnasically no declarations in it. I spent a little time profiling it,
and someone else did some more work. He found a few places where type
declarations help some - mostly declarations that things are
better-sorts-of-arrays so array ndexing can do better (the parser
reads into buffers which are arrays because a lot of what it generates
is strings). We got between 1 and 5% speedup. We might not have
found the big problems of course, but really, it looks like type
declarations don't help here much at all.
--tim
More information about the Python-list
mailing list