[Ecls-list] INLINE now works

Matthew Mondor mm_lists at pulsar-zone.net
Sun Dec 18 20:15:12 UTC 2011

On Sun, 18 Dec 2011 20:33:22 +0100
Juan Jose Garcia-Ripoll <juanjose.garciaripoll at googlemail.com> wrote:

> On Sun, Dec 18, 2011 at 8:09 PM, Matthew Mondor <mm_lists at pulsar-zone.net>wrote:
> > If I remember SBCL inlines flet/labels by default, yet I'm unsure if
> > this is always done or only for small functions, I assume the latter.
> >
> I am not very keen on this, at least not with the current code, because
> analyzing what is large and what not is a bit complicated and can only be
> done in the second phase of the analysis -- when everything is stored as a
> list of structures and the lisp code is no longer recognizable.

It's also unclear for me at which OPTIMIZE SPEED level that takes
place.  But explicitely having to define functions to be inlined is no
problem for me, just like I'm used to do with C and -O2 (gcc).
Although the compiler, if properly tuned for an architecture
(especially IRT to cache sizes), might do a better job at counting
cycles, I think that a human generally knows pretty well what makes
sense to inline explicitely.

> In any case, if the FLET/LABELS function is small enough and is not closed
> over variables, the C compiler will inline it most of the time.

At least with -O3 (gcc), indeed.  With -O3 the compiler has to know or
assume cache sizes and take them into account (especially that it'll
also try to unroll loops, not only inline functions), so for generic
i686 code -O2 may be preferable, but ECL would have the same problem
anyway, and unlike the C compiler, it wouldn't be able to properly
evaluate when it's really worthwhile to inline/unroll...

More information about the ecl-devel mailing list