Subject: Re: How much tuning does regular lisp compilers do?
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 30 Aug 2008 06:36:26 -0500
Newsgroups: comp.lang.lisp
Message-ID: <YtidndpTnYwnrSTVnZ2dnUVZ_g2dnZ2d@speakeasy.net>
Don Geddis  <don@geddis.org> wrote:
+---------------
| rpw3@rpw3.org (Rob Warnock) wrote on Fri, 29 Aug 2008:
| > For example, in CMUCL, consider these successive trials:
| >     cmu> (time (dotimes (i 2000000000)))
| > Note that the same loop took ~4, ~4, ~2, & ~4 CPU cycles/iteration.
| 
| Shouldn't you first compile code, that you want to time?
+---------------

WQell, what I wonder is why you failed to quote the lines from my post
that showed that each run *WAS* in fact being compiled [which CMUCL does
by default for each call to TIME]?!?!?

    cmu> (time (dotimes (i 2000000000)))
    ; Compiling LAMBDA NIL:                  <=== THESE TWO LINES
    ; Compiling Top-Level Form:              <=== THESE TWO LINES

    ; Evaluation took:
    ;   2.73f0 seconds of real time
    ;   2.720226f0 seconds of user run time
    ;   0.0f0 seconds of system run time
    ;   6,045,046,240 CPU cycles
    ;   0 page faults and
    ;   0 bytes consed.
    ; 
    NIL
    cmu>

+---------------
| > Why? Because the third compilation was more optimally placed for
| > the CPU's branch prediction (Athlon-32, as it happens).
| 
| If you're running interpreted code, how can you be so certain that
| this is the correct explanation for the difference in run times?
+---------------

1. Because it's *NOT* "interpreted code" (see above).

2. Because I spent quite a bit of time one afternoon examining this
   situation at length. [See my parallel reply to "verec" for details.]


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607