This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; | |
;;; Yet another porting of Dr. Norvig's Sudoku Solver, in Common Lisp | |
;;; | |
;;; @nfunato 2017-12-31 | |
;;; Please see the original article (http://norvig.com/sudoku.html) for detail. | |
;;; Note | |
;;; | |
;;; - I intentionally tried to keep the smell of the original code, except |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; anaphoras and the like | |
(defmacro aif (tst thn &optional els) `(let ((it ,tst)) (if it ,thn ,els))) | |
(defmacro awhen (tst &body body) `(let ((it ,tst)) (when it ,@body))) | |
(defmacro aprog1 (f . fs) `(let ((it ,f)) ,@fs it)) | |
(defmacro acond (&rest cls) | |
(if (null cls) nil | |
(let ((cl1 (car cls)) (sym (gensym))) | |
`(let ((,sym ,(car cl1))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Brief explanation what I did to get the speed-up, and the thought process behind it. | |
The original code went: | |
EnterLoop: | |
movaps xmm3, xmmword ptr [edx+ecx*2] // Box1YZ | |
cmpnltps xmm3, xmm2 | |
movmskps eax, xmm3 | |
cmp eax, 0Ch |