Skip to main content


I came across a blog from a 2 years ago that compared different implementations of dot product. It had a couple interesting points. The cost of functional programming in #Swift was huge (31x on M1 and 198x on x86). I did an equivalent test in #Rust and the cost was 1x (on M2). That lets programmers use the high level abstractions without dreading the performance costs.

Rust:
left.iter().zip(right.iter())
.map(|(&l, &r)| l * r )
.sum::<f64>()
https://eclecticlight.co/2021/08/04/when-idiomatic-code-is-slower-and-how-to-accelerate/