
not be expecting any unpredictable behavior from anything else
than language transition.
•
With respect to parameters internal to the languages, we saw
that there can be surprising differences in behavior between C
and LISP. For instance, we showed that plain 2D array repre-
sentations behave quite differently (slow in LISP), and that per-
formance can depend on the data type in LISP (which does not
happen in C). However, as soon as optimization is at work, and
is the main goal, those differences vanish: we are led to choose
equivalent data structures (namely 1D (simple) arrays), and re-
gain homogeneity on the treatment of different data types. This
is also comforting for considering language transition.
•
Since Fateman et al. (1995); Reid (1996), considerable work
has been done in the LISP compilers in the fields of efficient nu-
merical computation and data structures, to the point that equiv-
alent LISP and C code entails strictly equivalent performance,
or even better performance in LISP sometimes. This should fi-
nally help getting C or C++ people’s attention.
•
We should also emphasize on the fact that these performance
results are obtained without intimate knowledge of either the
languages or the compilers: only standard and / or portable
optimization settings were used.
To be fair, we should mention that with such simple algorithms
as the ones we tested, we are comparing compilers performance
as well as languages performance, but compiler performance is a
critical part of the production chain anyway. Moreover, to be even
fairer, we should also mention that when we speak of “equivalent
C and LISP” code, this is actually quite inaccurate. For instance,
we are comparing a language construct ( ) with a programmer
macro ( ); we are comparing sealed function calls in C with
calls to functions that may be dynamically redefined in LISP etc..
This means that it is actually impossible to compare exclusively
either language, or compiler performance. This also means that
given the inherent expressiveness of LISP, compilers have to be
even smarter to reach the efficiency level of C, and this is really
good news for the LISP community.
LISP still has some weaknesses though. As we saw in sec-
tion 4.2 on page 6 it is not completely trivial to type LISP code
both correctly and minimally (without cluttering the code), and a
fortiori portably. Compilers may behave very differently with re-
spect to type declarations, may provide type inference systems of
various quality, and who knows which more or less advertised op-
timization flag of their own (this happens also in C however). The
yet-to-be-explained problem we faced with ACL’s ac-
cess is the perfect example. Maybe the COMMON-LISP standard
leaves too much freedom to the compilers in this area.
Another current weakness of LISP compilers seems to be inlin-
ing technology. ACL simply does not support user function inlining
yet. The poor performance of CMU-CL in this area seems to indi-
cate that inlining defeats its register allocation strategy. It is also
regrettable that none of the tested compilers are aware of the in-
teger constant division optimization brought to light with C, and
from which inlining makes a big difference.
7. Perspectives
The perspectives of this work are numerous. We would like to
emphasize on the ones we think are the most important.
7.1 Further Investigation
The research described in this paper is still ongoing. In particular,
we have outlined several currently unexplained behaviors with re-
spect to typing, performance, or optimization of such or such LISP
compiler. These oddities should be further analyzed, as they prob-
ably would reveal room for improvement in the compilers.
7.2 Vertical Complexity
Benchmarking these very simple algorithms was necessary to iso-
late the parameters we wanted to test (namely pixel access and
arithmetic operations). These algorithms can actually be consid-
ered as the kernel of a special class of image processing ones called
“point-wise algorithms”, involving pixels one by one. It is likely
that our study will remain relevant for all algorithms in this class,
but nevertheless, the same experiments should be conducted on
more complex point-wise treatments, involving more local vari-
ables, function calls etc. for instance in order to spot potential
weaknesses in the register allocation policies of LISP compilers,
as the inlining problem tends to suggest, or in order to evaluate the
cost of function calls.
This is also the place where it would be interesting to measure
the impact of compiler-specific optimization capabilities, including
architecture-aware ones like the presence of SIMD (Single Instruc-
tion, Multiple Data) instruction sets. One should note however that
this leads to comparing compilers more than languages, and that
the performance gain from such optimizations would be very de-
pendant on the algorithms under experimentation (thus, it would be
difficult to draw a general conclusion).
7.3 Horizontal complexity
Besides point-wise algorithms, there are two other important algo-
rithm classes in image processing: algorithms working with “neigh-
borhoods” (requiring several pixels at once) and algorithms like
front-propagation ones where treatments may begin at several ran-
dom places in the image. Because of their very different nature in
pixel access patterns, it is very likely that their behavior would be
quite different from what we discussed in this paper, so it would be
interesting to examine them too.
Also, because of their inherent complexity, this is where the dif-
ferences in language expressiveness would be taken into account,
and in particular where it would become important to include GC
timings in the comparative tests, because it is part of the language
design (not to mention the fact that different compilers use different
GC techniques which adds even more parameters to compare).
7.4 Benchmarking other compilers / architectures
The benchmarks presented in this paper were obtained on a spe-
cific platform, with specific compilers. It would be interesting to
measure the behavior and performance of the same code on other
platforms, and also with other compilers. The automated bench-
marking infrastructure provided in the source code should make
this process easier for people willing to do so.
7.5 From dedication to genericity
Benchmarking low-level, fully dedicated code was the first step in
order to get C or C++ people’s attention. However, most image
treaters want some degree of genericity: genericity on the image
types (RGB, Gray level etc.), image representation (integers, un-
signed, floats, 16bits, 32bits etc.), and why not on the algorithms
themselves. To this aim, the object oriented approach is a natu-
ral way to go. Image processing libraries with a variable degree
of genericity exist both in C++ and in LISP, using CLOS (Keene,
1989) . As a next step of our research, a study on the cost of dy-
namic genericity in the same context as that of this paper is at work
already. However, given the great flexibility and expressiveness of
CLOS that C++ people might not even feel the need for (classes
can be redefined on the fly, the dispatch mechanism is customiz-
able etc.), the results are not expected to be in favor of LISP this
time.
11