2 ms·
There are a few tricks to getting Julia to be actually fast, and while it's not hard per se if you know them all (at least for numerical work), it's definitely
by cbkeller 5y ago
There are a few tricks to getting Julia to be actually fast, and while it's not hard per se if you know them all (at least for numerical work), it's definitely not trivial.
IMHO, you really have to embrace dispatch-oriented programming, and that includes being scrupulous about avoiding type instability. You also have to be a bit conscious about allocations, since it's easy to write Julia code (especially if you're trying to write in a "vectorized" style as is common in R, Python, Matlab) that generates absurd numbers of allocations, which must then be garbage-collected. But also easy to avoid those allocations if you know.
It took about two years, but after picking up more of this, I was eventually able to switch everything my group does from a two-language solution of matlab for scripts and plotting and C (with MPI) for HPC to all-Julia. This [1] was originally targeted at academics making the same switch, but much of it could be relevant to those with an R background as well.
[1] https://github.com/brenhinkeller/JuliaAdviceForMatlabProgrammers https://github.com/brenhinkeller/JuliaAdviceForMatlabProgram...