[Ecls-list] Some improvements

Juan Jose Garcia-Ripoll juanjose.garciaripoll at googlemail.com
Fri Jul 3 13:03:29 UTC 2009


I have been optimizing ASET / AREF (actually the C versions
ecl_aref/aset which are used in compiled code) and learned a few
things.

- Function calls are very expensive. Currently ecl_aset still has an
additional function call that involves the unchecked version, and a
function call to create integers/floats from the array data.

- PIC code is also horribly slow. This kills us sometimes when we use
constants, or when a function has a call to an error function. In this
case the function will call a library function to find out the data
segment address even if the data is _never_ used.

- SBCL can avoid these problems because it does not use PIC code: it
knows the address of everything. Of course, that makes it harder for
SBCL to cooperate with the OS.

- Use GCC >= 4.2. The GCC 4.0 shipped with OS X sucks.

- GCC refuses to optimize tail calls to neighboring functions with the
same # of arguments. I do not know why. Perhaps because of the
debugging flags.

- Order of IF/ELSE branches in C code matters.

Some of these things can be circumvented. For instance ecl_aref() has
now decreased a 25% execution time, based on some trivial benchmarks,
just from removing a branch jump and reorganizing the error signalling
code.

Juanjo

-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com




More information about the ecl-devel mailing list