Last active
March 28, 2019 12:17
-
-
Save inconvergent/3718bee9d08de0b03bbf0f8fdf6c828d to your computer and use it in GitHub Desktop.
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
#!/usr/bin/sbcl --script | |
(declaim (inline rnd)) | |
(defun rnd (a) | |
(declare (double-float a)) | |
(the double-float (random (the double-float a)))) | |
(declaim (inline sb-kernel::%random-fixnum)) | |
(sb-ext:unlock-package 'sb-kernel) | |
(let ((n 300000000)) | |
(time (loop repeat n do (rnd 10d0))) ; 3.226 seconds | |
(time (loop repeat n do (sb-kernel::%random-double-float 10d0 *random-state*))) ; 3.290 seconds | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment