Since NumPy is called out here, I wrote an example in KlongPy which is NumPy backed and got about 1ns/iter on my M2 Studio:
dot::{+/xy};mag::{(+/xx)^0.5};cossim::{dot(x;y)%mag(x)*mag(y)};cd::{1-cossim(x;y)}
https://github.com/briangu/klongpy/blob/main/examples/ml/cos...