[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Re: Bignum performance (was: Shrinking the C core)
From: |
Ihor Radchenko |
Subject: |
Re: [PATCH] Re: Bignum performance (was: Shrinking the C core) |
Date: |
Mon, 14 Aug 2023 09:42:22 +0000 |
Gerd Möllmann <gerd.moellmann@gmail.com> writes:
> Ok. I used the code from https://dataswamp.org/~incal/cl/fib.cl/fib.cl.
> ...
> The declaration means we are lying to the compiler because Z gets bigger
> than 53 bits eventually. And all bets are off because of the OPTIMIZE
> declaration. The result is that everything is done in fixnums on 64-bit
> machines.
That explains a lot :)
I now tried
(defun fib (reps num)
(declare (optimize speed (safety 0) (debug 0)))
(let ((z 0))
;; (declare (type (unsigned-byte 53) reps num z))
(dotimes (r reps)
(let*((p1 1)
(p2 1))
(dotimes (i (- num 2))
(setf z (+ p1 p2)
p2 p1
p1 z))))
z))
and got
$ SBCL_HOME=/usr/lib64/sbcl perf record sbcl --load /tmp/fib.cl
;;; 0.263333 s real time
;;; 0.263641 s run time
$ ~/Git/emacs/src/emacs -Q -batch -l /tmp/fib.eln
0.739 s
Still ~3x faster compared to Elisp, but not orders of magnitude.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Gerd Möllmann, 2023/08/14
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Gerd Möllmann, 2023/08/14
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Ihor Radchenko, 2023/08/14
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Gerd Möllmann, 2023/08/14
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Ihor Radchenko, 2023/08/14
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Gerd Möllmann, 2023/08/14
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core),
Ihor Radchenko <=
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/15
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Ihor Radchenko, 2023/08/15
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/15
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/15
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), tomas, 2023/08/16
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/16
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/14
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Gerd Möllmann, 2023/08/15
- Re: [PATCH] Re: Bignum performance (was: Shrinking the C core), Emanuel Berg, 2023/08/15
- Re: [PATCH] Re: Bignum performance, Po Lu, 2023/08/15