Julia: Performance Tips
31 points
by tosh
3 days ago
| 1 comment
| docs.julialang.org
| HN
pachico
1 hour ago
[-]
Legitimate and honest question: in which circumstances would you choose Julia over more mainstream alternative like Go?
reply
wolvesechoes
23 minutes ago
[-]
It is highly interactive and dynamic, yet performant. And it is not only about scientific computing, for almost any application can take advantage of interactive, modifiable system, where you can explore your state at any point. In others, more static langs good debuggers help with this to lesser or larger extend, but it is not the same from my experience.

So better question is: in which circumstances would you choose Julia over more mainstream-y alternative like Clojure? And here scientific and numerical angle comes to play.

At the same time I think Julia is failed attempt, with unsolvable problems, but it is a different topic.

reply
kryptiskt
37 minutes ago
[-]
Go is a total non-starter, it's not interactive at all. The competitors are things like Matlab, Mathematica, R or Python (with the right math libs). If you're weird you could use something like Haskell, APL or Lisp in this role, but you'd pay a hefty price in available libs.
reply
Human-Cabbage
1 hour ago
[-]
Julia is aimed at scientific computing. It competes against Python with numpy/scipy, R, etc.
reply
ziotom78
1 hour ago
[-]
Correct, but I would add: Julia is better than Python+NumPy/SciPy when you need extreme speed in custom logic that can’t be easily vectorized. As Julia is JIT-compiled, if your code calls most of the functions just once it won’t provide a big advantage, as the time spent compiling functions can be significant (e.g., if you use some library heavily based on macros).

To produce plots out of data files, Python and R are probably the best solutions.

reply
dgfl
21 minutes ago
[-]
Disagree on the last statement. Makie is tremendously superior to matplotlib. I love ggplot but it is slow, as all of R is. And my work isn’t so heavy on statistics anyway.

Makie has the best API I’ve seen (mostly matlab / matplotlib inspired), the easiest layout engine, the best system for live interactive plots (Observables are amazing), and the best performance for large data and exploration. It’s just a phenomenal visualization library for anything I do. I suggest everyone to give it a try.

Matlab is the only one that comes close, but it has its own pros and cons. I could write about the topic in detail, as I’ve spent a lot of time trying almost everything that exists across the major languages.

reply
dan-robertson
12 minutes ago
[-]
I tried some Julia plotting libraries a few years ago and they had apis that were bad for interactively creating plots as well as often being buggy. I don’t have performance problems with ggplot so that’s what I tend to lean to. Matplotlib being bad isn’t much of a problem anymore as LLMs can translate from ggplot to matplotlib for you.
reply
jey
41 minutes ago
[-]
And I would further add: In addition to performance, Julia's language and semantics are much more ergonomic and natural for mathematical and algorithmic code. Even linear algebra in Python is syntactically painful. (Yes, they added the "@" operator for matmul, but this is still true).
reply
setopt
49 minutes ago
[-]
Scientific computing. AFAIK, library support for that in Go is almost nonexistent.
reply
markkitti
1 hour ago
[-]
When I need to do serious math, I use Julia.
reply
bandrami
17 minutes ago
[-]
Math. Places you might use Wolfram or Sage.
reply