SBCL循环中没有Consing

时间:2019-06-05 04:16:23

标签: loops common-lisp sbcl

* (defparameter lst (make-list 1000))
LST
* (time (loop for x in lst
              for i from 0
              unless (= i 500)
              collect x))
Evaluation took:
  0.000 seconds of real time
  0.000000 seconds of total run time (0.000000 user, 0.000000 system)
  100.00% CPU
  47,292 processor cycles
  0 bytes consed

SBCL如何构建包含0个字节的返回列表?

1 个答案:

答案 0 :(得分:1)

对于time,您的测试用例太小。尝试(defparameter lst 100000)

Evaluation took:
  0.003 seconds of real time
  0.003150 seconds of total run time (0.002126 user, 0.001024 system)
  100.00% CPU
  8,518,420 processor cycles
  1,579,472 bytes consed