Re: How much tuning does regular lisp compilers do?



Don Geddis <don@xxxxxxxxxx> wrote:
+---------------
| rpw3@xxxxxxxx (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@xxxxxxxx>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607

.



Relevant Pages

  • Re: CLISP, CMUCL, SBCL, does it matter?
    ... > believing all of the hype that CMUCL was so difficult to rebuild. ... There are internals and there are internals. ... To compile this, the same build procedure in SBCL simply ... > that there was really nothing difficult about rebuilding CMUCL. ...
    (comp.lang.lisp)
  • Re: Is CMUCL insane? P.S. Me vs. CLM (Common Lisp Music)
    ... Or to build Windows without a working version of Windows. ... why are you trying to compile CMUCL?" ... let's assume I use Linux and not an emulator here... ...
    (comp.lang.lisp)
  • Re: Newbie question on passing functions as arguments
    ... If I compile this with CMUCL I get an error ... > The correct syntax would be ... Ahh, the famous CMUCL. ... the correct defun doesn't cause any errors. ...
    (comp.lang.lisp)
  • Re: memory usage in cmucl
    ... |> with the memory size constantly increasing). ... One additional issue is that the CMUCL interpreter tends to generate ... although IIRC I did initially compile the ... one could be leaking memory in cmucl, ...
    (comp.lang.lisp)