Runtime speed for vectorized vs. devectorized code in Julia
05 Jan 2015When dealing with arrays, we have two choices: apply a for
loop or vectorize an array: apply the desired changes to all members of the array in a single statement. Vectorization famously speeds up R and Python code, which is why using for
loops is discouraged for these languages.
From what I read, Julia is more optimized for running for
loops. For example, according to John Myles White, the author of DataFrames
library:
I really like for loops. That's why I like that Julia makes it easy to write a loop that's 700x faster than Python: https://t.co/WjKikqyXTM
— John Myles White (@johnmyleswhite) May 10, 2013