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

Elijah Stone elronnd at elronnd.net
Sat Apr 2 17:46:06 PDT 2022


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
> 
>


More information about the Cmdist mailing list