From: Thierry Volpiatto <thierry.volpiatto@gmail.com>
To: emacs-devel@gnu.org
Subject: cl position performances
Date: Tue, 23 Feb 2010 10:30:08 +0100 [thread overview]
Message-ID: <871vgc1eqn.fsf@tux.homenetwork> (raw)
Hi,
i wrote a very simple definition of `position' for use in
traverselisp.el,(to avoid warnings) and i noticed that this is faster
than the usual cl `position'.
That can be interesting for very large list.
,----
| (defsubst* traverse-position (item seq &key (test 'eq))
| "A simple replacement of CL `position'."
| (loop for i in seq for index from 0
| when (funcall test i item) return index))
`----
,----
| ELISP> (position (bookmark-get-bookmark "mes_scripts") bookmark-alist)
| 525
| ELISP> (traverse-position (bookmark-get-bookmark "mes_scripts") bookmark-alist)
| 525
`----
,----
| position 2 0.000817 0.0004085
| traverse-position 1 0.000283 0.000283
`----
Also,
would be great all the (great) CL package be more integrated in elisp.
Just an example:
Try to get documentation of this same `position' function with C-h S.
--
Thierry Volpiatto
next reply other threads:[~2010-02-23 9:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-23 9:30 Thierry Volpiatto [this message]
2010-02-24 18:24 ` cl position performances Stefan Monnier
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=871vgc1eqn.fsf@tux.homenetwork \
--to=thierry.volpiatto@gmail.com \
--cc=emacs-devel@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.