[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cl position performances

From: Thierry Volpiatto
Subject: cl position performances
Date: Tue, 23 Feb 2010 10:30:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (gnu/linux)

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") 
| 525

| position           2           0.000817      0.0004085
| traverse-position  1           0.000283      0.000283


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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]