[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ..
From: |
Alex Gramiak |
Subject: |
Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}) |
Date: |
Sun, 21 Apr 2019 14:34:09 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Stefan Monnier <address@hidden> 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.
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), (continued)
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), Eli Zaretskii, 2019/04/20
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), Alex Gramiak, 2019/04/20
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), Eli Zaretskii, 2019/04/20
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), Alan Mackenzie, 2019/04/20
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), Óscar Fuentes, 2019/04/20
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), Paul Eggert, 2019/04/20
- 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/20
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), Alex Gramiak, 2019/04/20
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), Eli Zaretskii, 2019/04/21
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), Stefan Monnier, 2019/04/21
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}),
Alex Gramiak <=
- Re: [RFC] Some new vector procedures (vector-{memq, apply, to-string, ...}), Stefan Monnier, 2019/04/21