cisco / ChezScheme

Chez Scheme
Apache License 2.0
6.89k stars 983 forks source link

CPU time very inaccurate on Windows 11 #779

Open slaymaker1907 opened 7 months ago

slaymaker1907 commented 7 months ago

On Windows 11 with an Intel 13900, the following causes incorrect reporting of CPU time:

(define (fibo n)
  (if (> n 2)
      (+ (fibo (sub1 n))
         (fibo (- n 2)))
      1))
(time (fibo 42))

One such execution gave me the output:

> (time (fibo 42))
(time (fibo 42))
    no collections
    0.453125000s elapsed cpu time
    0.809243000s elapsed real time
    0 bytes allocated
267914296

However, if I set affinity of the process to CPU 0 (locking it to one core), it correctly computes the CPU time.

> (time (fibo 42))
(time (fibo 42))
    no collections
    0.828125000s elapsed cpu time
    0.855630300s elapsed real time
    0 bytes allocated
267914296

I've tested this many times and have even seen this behavior on the non-threaded version.