Hacker News new | ask | show | jobs
by KenoFischer 3222 days ago
While I have absolutely no problem believing that a carefully, tuned special purpose system like Stan readily beats the equivalent julia libraries, I'd caution against making inferences about the speed of any code written in a particular language as a result. Once a certain level of performance is reached, for most applications, the primary performance factor is algorithmic (and I include things like memory layout/cache friendliness in these). As the simplest example, consider matrix multiply. The venerable triple-loop will perform about the same whether it is written in Julia, C, Assembly, Rust, Nim or Fortran (ignoring for the moment compilers with specific matmul pattern recognition). However, depending on your CPU, you're leaving anywhere between 10-100x performance on the table by not using BLAS. Now, BLAS happens to be written in assembly and Fortran, but that's not the point. If you used the same algorithms in Julia code, it would achieve the same performance.

As for the benchmarks you posted, the worst I see Julia performing in that list is on the JSON benchmark. However, again, that's benchmarking a library. Doing high performance text parsing well is a non-trivial problem and JSON.jl isn't a super high performance library. The fact that nobody has sat down and written one yet is more of a reflection of the user community (since JSON is mostly associated with the web stack, JSON-parsing tends to be more incidental for julia users, than languages/libraries that are more focused in that area) than any performance limitation of the language - in fact I think I recently did see somebody working on a higher-performance version, but I don't have the link handy.

To summarize, it is true that some languages (or rather their implementations) are slow, causing an automatic slowdown to projects written therein, but that is generally not the case for julia (or C or Nim or Rust, etc). Once you get to that point, other things matter more, and it is important to distinguish that. In the case of Turing.jl, the linked wiki mentions that one of the primary factors impacting performance is their use of forward AD, when reverse AD would be algorithmically better. It seems understandable, that a newer project would be algorithmically less sophisticated than a more established one. However, that'll get fixed over time and the other benefits will become more and more prominent as a result.