Hacker News new | ask | show | jobs
by ssfrr 2942 days ago
Better cache access patterns are one of the reasons Julia's dot-broadcasting[1] is super cool. If you have big vectors `a` and `b`, the expression `sin.(a .+ exp.(b))` will do a single pass over your data, calling `sin(a[i]+exp(b[i]))` for each element, rather than creating big temporary arrays for the intermediate expressions and looping through multiple times.

Then because putting all those dots can be unwieldy, there's the `@.` macro which puts a dot on all your function calls.

[1]: https://julialang.org/blog/2017/01/moredots