New inline stable sort for vectors This PR should improve on the current stable sorting of vectors, fixing issues such as #217 (bug) and #101 (performance). Full disclosure: The merge sort algorithm was completely stolen from sbcl. I'm sure the new version can be optimized, for example by inlining `stable-sort-merge-vectors`, and by treating simple-arrays differently. But for now, it already has slightly better performance on the sequences that I tested with, for example running: ```common-lisp (time (dotimes (x 50000) (defparameter *my-arr* (make-array 9 :initial-contents (list (cons 3 'a) (cons 2 'b) (cons 2 'c) (cons 2 'd) (cons 3 'e) (cons 2 'f) (cons 2 'g) (cons 2 'h) (cons 1 'i)))) (stable-sort *my-arr* #'< :key #'car))) ``` gave me 0.34 sec in the old version, and 0.28sec in the new one (even with the overhead of the make-array call, which is the same for both). But most importantly, the new version leaves the array sorted, which fixes bug #217: ```common-lisp > *my-arr* #A(T (9) ((1 . I) (2 . B) (2 . C) (2 . D) (2 . F) (2 . G) (2 . H) (3 . A) (3 . E))) ``` while in the old-version: ```common-lisp > *my-arr* #A(T (9) ((3 . A) (2 . B) (2 . C) (2 . D) (3 . E) (2 . F) (2 . G) (2 . H) (1 . I))) ``` The example in #217 also works now, of course: ```common-lisp > (let ((a (copy-seq "BCA"))) (stable-sort a #'char<) a) "ABC" ``` See merge request !28 |
||
|---|---|---|
| contrib | ||
| doc | ||
| examples | ||
| msvc | ||
| src | ||
| .gitignore | ||
| CHANGELOG | ||
| configure | ||
| INSTALL | ||
| LGPL | ||
| LICENSE | ||
| Makefile.in | ||
| README.md | ||
ECL stands for Embeddable Common-Lisp. The ECL project aims to produce an implementation of the Common-Lisp language which complies to the ANSI X3J13 definition of the language.
The term embeddable refers to the fact that ECL includes a Lisp to C compiler, which produces libraries (static or dynamic) that can be called from C programs. Furthermore, ECL can produce standalone executables from Lisp code and can itself be linked to your programs as a shared library. It also features an interpreter for situations when a C compiler isn't available.
ECL supports the operating systems Linux, FreeBSD, NetBSD, DragonFly BSD, OpenBSD, Solaris (at least v. 9), Microsoft Windows (MSVC, MinGW and Cygwin) and OSX, running on top of the Intel, Sparc, Alpha, ARM and PowerPC processors. Porting to other architectures should be rather easy.