all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Gramiak <agrambot@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...})
Date: Sat, 20 Apr 2019 10:50:28 -0600	[thread overview]
Message-ID: <87lg047h9n.fsf@gmail.com> (raw)
In-Reply-To: <83lg05b1jk.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 20 Apr 2019 10:04:15 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Alex Gramiak <agrambot@gmail.com>
>> Date: Fri, 19 Apr 2019 14:49:39 -0600
>> 
>> Here are a few procedures that should make using vectors in Elisp a bit
>> nicer. They are in C since all the Elisp versions I've tried were too
>> slow for such simple procedures.
>
> Doesn't seq.el already provide this functionality?

Some, but not all. I don't see a vector-partition equivalent
(seq-partition is different), or a vector-index equivalent
(seq-find/cl-find return the element instead of the index, and is ~10x
slower).

I don't see any replacement for vector-apply, but I admit that the worth
of that one might not be worth the change at this point.

Though I just remembered that (concat vec) does the same as
vector-to-string; if vector-to-string is added, then I suppose it should
be a Lisp wrapper around concat just like string-to-vector is around
vconcat.

> As for speed, did you have any application where the speed of the Lisp
> implementation was inadequate?

For vector-memq, the Lisp implementations almost disallow it from being
used over memq/lists. The equivalent in seq.el, seq-position, is ~100x
slower for smaller vectors and ~200x for larger (500 elements) vectors.
A cl-loop implementation is just slightly better than seq-position.

The main two I care about here are vector-memq/vector-member. The other
ones were just ones I thought up while I was at it.



  reply	other threads:[~2019-04-20 16:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19 20:49 [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}) Alex Gramiak
2019-04-20  7:04 ` Eli Zaretskii
2019-04-20 16:50   ` Alex Gramiak [this message]
2019-04-20 17:16     ` Eli Zaretskii
2019-04-20 18:18       ` Alex Gramiak
2019-04-20 19:11         ` Eli Zaretskii
2019-04-20 19:54           ` Alan Mackenzie
2019-04-20 20:09             ` Óscar Fuentes
2019-04-20 22:54           ` Paul Eggert
2019-04-21  3:01             ` Using SMALL_LIST_LEN_MAX for memq and list_length (was: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...})) Alex Gramiak
2019-04-21  1:52           ` [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}) Alex Gramiak
2019-04-21  5:50             ` Eli Zaretskii
2019-04-21  4:05     ` Stefan Monnier
2019-04-21 20:34       ` Alex Gramiak
2019-04-21 21:01         ` 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=87lg047h9n.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=eliz@gnu.org \
    --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.