Then just for fun i tested same thing in java (numeric sorting of 10mil integers with random values inserted) .. and on the end it's 10x faster then clozure CL and 40x times faster then sbcl.
Suprise for me that sbcl is much slower then ccl, also that java is so much faster then both clozure and sbcl ..
Also perl is 2x faster then clozure and 7-8x faster then sbcl .. and that is really unexpected.
Benchmarking just allocation and array access shows that sbcl is fastest (aprox 2-3x faster then java).
It's obvious that sorting is slow in both ccl and sbcl, meaby someone who understand implementation of lisp can tell me more.
I noticed that java implements quicksort and sbcl heapsort , but it cant be just that .. also java sort() is specialized numeric sort, and lisp sort accept predicate function ..
lisp testing code:
Code: Select all
(defun test ()
(declare (optimize (speed 3) (debug 0) (safety 0) (compilation-speed 0)))
(let ((a (make-array 10000000 :element-type 'fixnum)))
(declare (type (simple-array fixnum (*)) a))
(loop for i of-type fixnum from 0 below 10000000
do (setf (aref a i) (random 100)))
(setf a (sort a #'>))
nil))