[CM] most efficient way to map over a vector?

Iain Duncan iainduncanlists at gmail.com
Sun Apr 3 10:06:13 PDT 2022


Thanks Elihah, that's basically what I'm doing.

Is there a speed advantage to using float-vector-set! over plain old set! ?

On Sat, Apr 2, 2022 at 5:47 PM Elijah Stone <elronnd at elronnd.net> wrote:

> Sorry, should be
>
> (do ((i 0 (+ 1 i))
>       (l (length v)))
>      ((>= i l))
>    (float-vector-set! v i (f (float-vector-ref v i))))
>
> On Sat, 2 Apr 2022, Elijah Stone wrote:
>
> > Probably:
> >
> > (do ((i 0 (+ 1 i))
> >     (l (length v)))
> >    (>= i l)
> >  (float-vector-set! v i (f (float-vector-ref v i))))
> >
> > Obviously substituting int-vector-* or byte-vector-* if appropriate.
> >
> > That said, if performance is really important, I might just write the
> code in
> > c.
> >
> > On Sat, 2 Apr 2022, Iain Duncan wrote:
> >
> >> Hi all, I'm mapping some transforms over vectors in a part of the code
> that
> >> I need to have run as efficiently as possible. I'm hoping someone can
> tell
> >> me what the fastest running approach to this is. I would like to leave
> the
> >> data as vector as it is used in a framebuffer at the C level.
> >> thanks!
> >> iain
> >>
> >>
> > _______________________________________________
> > Cmdist mailing list
> > Cmdist at ccrma.stanford.edu
> > https://cm-mail.stanford.edu/mailman/listinfo/cmdist
> >
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
> https://cm-mail.stanford.edu/mailman/listinfo/cmdist
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20220403/fa4ec51f/attachment.html>


More information about the Cmdist mailing list