[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Vector and List Performance
From: |
Nordlöw |
Subject: |
Vector and List Performance |
Date: |
Mon, 8 Jun 2009 10:27:01 -0700 (PDT) |
User-agent: |
G2/1.0 |
I'm trying to figure the performance different between lists and
vectors. Here is my mockup:
(defun bench (&rest forms)
"Convenience wrapper for benchmark-run-compiled."
(/ (nth 0 (benchmark-run 1024 forms)) 1024))
(let ((length 1000000))
(cons
(bench (aref (make-vector length 0) (/ length 2)))
(bench (nth (/ length 2) (make-list length 0)))
))
Strangely I can't seem to find any significant different in
performance when accessing the middle element in a long vector and
long list. Shouldn't the random access performance be the big
difference between vectors and lists? What have I missed?
Thanks in advance,
Per Nordlöw
- Vector and List Performance,
Nordlöw <=