[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Vector and List Performance
From: |
Pascal J. Bourguignon |
Subject: |
Re: Vector and List Performance |
Date: |
Tue, 09 Jun 2009 14:51:22 +0200 |
User-agent: |
Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux) |
Nordlöw <per.nordlow@gmail.com> writes:
> Aahh, we needed a macro instead:
>
> (defmacro bench (&rest forms)
> "Convenience wrapper for benchmark-run-compiled."
> `(let ((n 10))
> (/ (nth 0 (benchmark-run n ,@forms)) n)))
>
> This gives a reasonable difference in performance.
>
> By the way, does elisp lists have extra pointers to the middle of the
> list (a skip-list)?
No, because it wouldn't be efficient to have to maintain them.
(let* ((c (list 7 8 9))
(b (list* 4 5 6 c))
(a (list* 1 2 3 b)))
(push -1 (cddr c)) (push -2 (cddr c)) ; you may have to update a big
number of skip-lists!
(list a b c))
-->
((1 2 3 . #1=(4 5 6 . #2=(7 8 -2 -1 9))) #1# #2#)
(deftype list () '(or null (cons t list))) ; nothing more.
--
__Pascal Bourguignon__