(sleep 0)
While debugging a program, I noticed that (sleep 0) in LW 5 (LW 5.0.2 on linux) seems to sleep 4 milliseconds, whereas in LW 4, it did not sleep a measurable amount of time. Bug or feature? -- (espen)
While debugging a program, I noticed that (sleep 0) in LW 5 (LW 5.0.2 on linux) seems to sleep 4 milliseconds, whereas in LW 4, it did not sleep a measurable amount of time. Bug or feature? -- (espen)
Espen Vestre wrote:
> While debugging a program, I noticed that (sleep 0) in LW 5
> (LW 5.0.2 on linux) seems to sleep 4 milliseconds, whereas in
> LW 4, it did not sleep a measurable amount of time.
>
> Bug or feature?
>
Don't know, but seems a function call needs a little time to do this.
Simple test:
SBCL:
CL-USER(1): (time (sleep 0))
Evaluation took:
0.005 seconds of real time
0.0 seconds of user run time
0.0 seconds of system run time
2 calls to %EVAL
0 page faults and
0 bytes consed.
NIL
CMUCL:
* (time (sleep 0))
; Compiling LAMBDA NIL:
; Compiling Top-Level Form:
; Evaluation took:
; 0.0 seconds of real time
; 0.0 seconds of user run time
; 0.0 seconds of system run time
; 41,592 CPU cycles
; 0 page faults and
; 0 bytes consed.
;
NIL
OpenMCL (x86_64 on linux):
? (time (sleep 0))
(SLEEP 0) took 0 milliseconds (0.000 seconds) to run
with 8 available CPU cores.
During that period, 0 milliseconds (0.000 seconds) were spent in user mode
0 milliseconds (0.000 seconds) were spent in system mode
NIL
GCL:
>(time (sleep 0))
real time : 0.010 secs
run-gbc time : 0.000 secs
child run time : 0.000 secs
gbc time : 0.000 secs
NIL
ECL:
> (time (sleep 0))
real time : 0.000 secs
run time : 0.000 secs
NIL
Allegro CL:
CL-USER(1): (time (sleep 0))
; cpu time (non-gc) 0 msec user, 0 msec system
; cpu time (gc) 0 msec user, 0 msec system
; cpu time (total) 0 msec user, 0 msec system
; real time 0 msec
; space allocation:
; 12 cons cells, 200 other bytes, 24 static bytes
NIL
LispWorks (64bit on Linux):
CL-USER 2 > (time (sleep 0))
Timing the evaluation of (SLEEP 0)
User time = 0.000
System time = 0.000
Elapsed time = 0.004
Allocation = 4424 bytes
0 Page faults
NIL
LispWorks (32bit on Windows, Personal):
CL-USER 2 > (time (sleep 0))
Timing the evaluation of (SLEEP 0)
User time = 0.000
System time = 0.000
Elapsed time = 0.000
Allocation = 6216 bytes
0 Page faults
NIL