[This page is under construction!]
This page lists the benefits and advantages of using Lisp.
All the examples were run on
- Xanalys LispWorks for Windows version 4.2
- Microsoft Visual C++ development environment, version 2003
The Ultimate Development Environment
The Lisp development environment provides the most powerful tools for developing
and debugging programs, for several reasons:
- Inspector
- Prompt, Fast debug cycle
The Ultimate High-Level Language
coming soon...
Efficiency Considerations
One of the false myths about Lisp is
that it is
less efficient than other languages like C/C++, because of its abundant use of memory (including automatic garbage collection)
and dynamic linking. The answers to that claim:
- Lisp is definitely much more development-time efficient (more on that will be written here soon). As the cost of computer
memory became very cheap in the past decade, and the speed of computers increased to be much higher than what is required for
many applications, managers are beginning to understand that development-time efficiency is much more important than run-time
efficiency, as a simple cost-benefit consideration: The time of developers is now much more expensive than the cost of faster
and bigger computers. That's why Java became so popular in recent years (though Java in general and its garbage collection
in particular are less efficient,
to my knowledge, than Lisp's, because Java has the extra layer of the virtual machine whereas Lisp code is translated to
efficient assembly language. A comparison between Java and Lisp will appear here soon).
- Lisp code can be optimized to be as efficient as C code. Once the first version of the code is complete and works, a
profiler (which is supplied with the development environments of both Allegro and LispWorks) can be run on the system to
discover those areas of the code where the system spends most of the execution time.
The developer's time can then be wisely used to optimize only these areas. Possible optimizations in Lisp inclue: adding types
and type assumptions (i.e. dropping the run-time checking of types); using fixed-length data (i.e. standard integers instead
of the unbounded Lisp numbers); static linking (inline code); and even calling an external module efficiently written in a
lower-level language (such as C++ or Assembly). Lisp, hence, offers the greatest flexibility: it does not force the developer
to worry about efficiency until the development is done, and offers tools to do so (rather than, like C++, force the developer
to waste enormeous amounts of time on type declaration and errors, compilation and re-compilation, static linking, etc.)
- For certain tasks, Lisp programs are actually more efficient than equivalent programs in other languages. The prime
example is what Lisp is best at: Symbolic Processing. In particular, the main symbolic operation is comparing two symbols (an
operation which may be called thousands or millions of times during the execution of a system). This is done in the most
efficient way possible in Lisp: pointer equality checking in O(1) time. In contrast, if symbols are represented as
usual by
strings, equality checking takes in the worse case O(n+1) time when equating two strings (where the shorter is
of
length n). Of course, one could implement pointer-based symbol checking also in C++, but that would amount to
re-implementing part of Lisp (probably much less efficiently than the available commercial implementations of Lisp, which
include further optimizations).
Further Reading
Articles by Paul Graham:
Back to the Smart Programming Page.