Is there a way to tell if my loops are vectorized?
# getting-started
u
Is there a way to tell if my loops are vectorized?
y
I don't think the Kotlin compiler makes any such optimization. Thus, what you'd want to look at is the assembly produced by the JIT compiler and see if that's vectorized.

This video▾

has some info about that (timestamp 9:48)
u
I'm noticing there is explicit vector api now, is that supposed to fix the guesswork?
y
I believe so
u
but the code is so verbose..woukd you happen to know of a higher level library? pythons numpy style probably?
d
@ursus What you said is virtually same as saying you need a library optimized with the vector API to handle your tasks. Since the vector API is not final (will not for a relatively long time due to the lack of value objects), not so many libraries out there are using it. I only see Apache Lucene using it quite actively internally. I'm using it in my project, and it's, as you said, a bit verbose, but worth leveraging. In my experience, it's usual to require the vector API only in the core, small areas in your code. If you don't want to bother with writing code with the vector API and what you need is something like data frame API, then you should wait a bit more until the major libraries leverage the vector API in their implementation.
u
im doing a physics sim so somethung numpy is very handy internet says there is jetbrains
multik
which is ndarray lib for kitlin
but kinda looks abandoned
d
ND4J/Jblas seem linking to the native binaries that in turn leverage SIMD instructions.