From: Alex Gramiak <agrambot@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...})
Date: Sun, 21 Apr 2019 14:34:09 -0600 [thread overview]
Message-ID: <87pnpf5c8u.fsf@gmail.com> (raw)
In-Reply-To: <jwvy344t3hz.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 21 Apr 2019 00:05:25 -0400")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 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.
>
> I'm not sure I like vector-apply, but I am interested in doing something
> along these lines for cl-generic: the use of wrappers of the form
>
> (lambda (x &rest args) ... (apply f x args))
>
> proves to be too costly in some cases (e.g. cl-print). But the main issue
> seems to be the allocation of a new list for `args`, so `vector-apply`
> doesn't really help here.
I'm not sure how one would avoid the allocation lambda does without a
new special form (or byte compiler optimization that checks that you
only give args to apply), but perhaps I'm overlooking something.
There could also be a &rest-vector, but that's likely going too far.
>> For vector-memq, the Lisp implementations almost disallow it from being
>> used over memq/lists.
>
> I your `vector-memq` significantly faster than `memq`?
Not hugely; about 15-25% when vector-memq is made into a 2-byte bytecode
(as in my other thread) for a 5 element collection, and about 50% on a
50-element collection.
> My impression is that for small enough "sets", even if a bit faster,
> `vector-memq` wouldn't bring much benefit, and for larger sets if
> performance is an issue you'd likely prefer using a completely different
> structure such as a hash-table.
Right, I'm not under the impression that it would be a monumental
difference (that's why I called it a stupid itch :). Still, I think
there's a middle ground between lists and hash tables that vectors would
fit into nicely enough.
next prev parent reply other threads:[~2019-04-21 20:34 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
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 [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pnpf5c8u.fsf@gmail.com \
--to=agrambot@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).