gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] Inlining


From: Camm Maguire
Subject: [Gcl-devel] Inlining
Date: 16 Dec 2006 01:18:11 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!  With the latest function src in core facility in 2.7.0, we
are finally in the position to achieve a long held goal -- to define
functions once and allow the compiler to collapse their definitions in
the appropriate environment, as opposed to writing a separate compiler
macro or c1 function to handle the compliation of each function.  This
clearly might only be of peripheral interest to users.

I've rewritten the seqlib locally with this facility in place, and it
produces very fast code, but can get big.  Like something under 40%
bigger.  I'd like some opinions on when inlining is worth it
(automatically, that is, the user should always be able to declare the
preference).   Some thoughts:

1) when the code is under a certain size
2) when closure arguments are supplied (which can then be eliminated)
30 when the argument types are smaller than the declared argument
   types
4) when the function is 'common.

GCL has always inlined member, mapcar, etc. without option or fuss,
and no one has complained.  What about remove, which has to handle
arrays and lists, but need handle only one in certain environments?
What about remove-duplicates, which is O(n^2)?

Also, is it correct to test performance on really big lists and
arrays, like of length 10000, even though the common case is much
smaller? 

Advice appreciated as always.

Take care,

=============================================================================
; 2.7.0
; length 10000
(time (dotimes (i 100) (remove-duplicates r)))

real time       :      0.990 secs
run-gbc time    :      1.000 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL

COMPILER>(defun g (x) (declare (list x))(remove-duplicates x))

G

COMPILER>(compile 'g)

#<compiled-function G>
NIL
NIL

COMPILER>(time (dotimes (i 100) (g r)))

real time       :      0.470 secs
run-gbc time    :      0.470 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL

COMPILER>

; 2.6.7

(time (dotimes (i 100) (remove-duplicates r)))

real time       :     11.870 secs
run-gbc time    :     11.860 secs
child run time  :      0.000 secs
gbc time        :      0.000 secs
NIL

=============================================================================

-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]