;; this file: ;; https://dataswamp.org/~incal/cl/bench/bubble-no-cons.cl ;; ;; original Elisp source: ;; elisp-benchmarks (load "~/public_html/cl/bench/timing.cl") (let*((bubble-len 1000) (bubble-lst (mapcar #'random (make-list bubble-len :initial-element most-positive-fixnum) ))) (defun bubble-no-cons (lst) (loop repeat (length lst) do (loop for x on lst for a = (car x) for b = (cadr x) when (and b (> a b)) do (rplaca x b) (rplaca (cdr x) a) finally (return lst)) )) (defun bubble-no-cons-entry () (loop repeat 200 for l = (copy-list bubble-lst) do (bubble-no-cons l) ))) (timing (bubble-no-cons-entry))