Absence of Consing in SBCL loop

Viewed 79
* (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

How does SBCL build the return list with 0 bytes consed?

1 Answers

Your test case is too small for time. Try (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
Related