Greetings! Robert Boyer <[EMAIL PROTECTED]> writes:
> I'm not quite sure I got the point with your timings of stuff like: > > (dotimes (i 2000) (setf (aref a i) (random 2000))) > (time (dotimes (i 2000) (reduce '+ a))) > (defun foo (a) (reduce '+ a)) > (compile 'foo) > (assert (= (foo a) (reduce '+ a))) > (time (dotimes (i 2000) (foo a))) > > So let me see if I can say what the point is. You have figured out how > function calls in dotimes, and presumably other, expressions now cost nothing > at all? What can you be doing besides straight inlining? Amazing. > The function call to either foo or reduce from dotimes is negligible. The real cost to many of the lisp builtins is the cost of a generic function call to a functional argument inside the (in this case) reduce loop, at least one per iteration, more if there are keys, etc. The compiler macros inline any constant functional arguments (including explicit lambda args) in lisp, allowing the optimizer to eliminate many of the function calls from the C code entirely. reduce here basically gets transformed to a do loop across (funcall '+ ...) I still at least have to finish map, substitute, remove, perhaps search and stable-sort. Feedback advice most appreciated, particularly if you feel such work might be a waste of time as no one uses these functions in the first place :-). Take care, > Bob > > > > > -- Camm Maguire [EMAIL PROTECTED] ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah _______________________________________________ Gcl-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/gcl-devel
