Subject: Re: help with numeric speed optimization
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 14 Aug 2006 22:43:35 -0500
Newsgroups: comp.lang.lisp
Message-ID: <0bSdnfwJbvh633zZnZ2dnUVZ_u-dnZ2d@speakeasy.net>
Thomas A. Russ <tar@sevak.isi.edu> wrote:
+---------------
| verec <verec@mac.com> writes:
| > On 2006-08-12 20:33:51 +0100, pkhuong@gmail.com said:
| > > 1. Note that the call to TIME also tells you that your function was
| > > interpreted, not compiled.
| > 
| > CL-USER 58 > (compile 'pi/2-opt)
| > ;;;*** Warning in PI/2-OPT: The definition of PI/2-OPT is already compiled.
| > PI/2-OPT
| > ((PI/2-OPT #<STYLE-WARNING 100B2BDF>))
| > NIL
| > 
| > It already was compiled :-(
| 
| The function PI/2-OPT may have been compiled, but what you tested with
| TIME was the following:
|    (time (dotimes (i 10000) (pi/2-opt)))
| and the DOTIMES loop is interpreted, not compiled.
+---------------

Interesting. In CMUCL, TIME always compiles the form to be timed:

    cmu> (time (dotimes (i 100000000)))
    ; Compiling LAMBDA NIL: 
    ; Compiling Top-Level Form: 

    ; Evaluation took:
    ;   0.11f0 seconds of real time
    ;   0.11f0 seconds of user run time
    ;   0.0f0 seconds of system run time
    ;   200,529,433 CPU cycles
    ;   0 page faults and
    ;   0 bytes consed.
    ; 
    NIL
    cmu> 


-Rob

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