all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nordlöw <per.nordlow@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Vector and List Performance
Date: Mon, 8 Jun 2009 10:27:01 -0700 (PDT)	[thread overview]
Message-ID: <c32bcfbc-f5a1-4bc4-a2fd-075d8f6e9558@e20g2000vbc.googlegroups.com> (raw)

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


             reply	other threads:[~2009-06-08 17:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08 17:27 Nordlöw [this message]
2009-06-08 19:57 ` Vector and List Performance Tassilo Horn
2009-06-09  9:30 ` Pascal J. Bourguignon
2009-06-09 11:30   ` Nordlöw
2009-06-09 12:51     ` Pascal J. Bourguignon
2009-06-09 18:13       ` Nordlöw
2009-06-10  8:24         ` Pascal J. Bourguignon
     [not found]         ` <7c63f45we1.fsf@pbourguignon.informatimago.com>
2009-06-10  8:36           ` Pascal J. Bourguignon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c32bcfbc-f5a1-4bc4-a2fd-075d8f6e9558@e20g2000vbc.googlegroups.com \
    --to=per.nordlow@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.