4 ms·
As a scientists who codes both Rust and Julia, I don't think Rust is anywhere near as good as Julia for scientific computing (as I elaborate in the posts on the
by jakobnissen 3y ago
As a scientists who codes both Rust and Julia, I don't think Rust is anywhere near as good as Julia for scientific computing (as I elaborate in the posts on the Julia Discourse about this blog post linked below).
Briefly, for scientific computing, rapid iteration, prototyping and redesign is one of the main requirements. So is "open internals", i.e. generic code and/or the ability to open up someone else's code and reuse parts. Speed is somewhere further down the list - which is why Python (and previously, Perl) are the dominant languages, not C++ or Rust.
Julia excels at all of these and as such is nearly perfect for science, whereas Rust is unusually bad at the "prototyping and redesign" part. Like, you change the ownership model of some struct, or some single type, and now you have to unravel half your code base to change type signatures and fix borrow checker woes. It's also just slow to write.
Rust is nice for scientific code that is more "application-like", such as command-like tools whose task is very well-defined and mature, as well as for large-scale scientific appliations. It's also nice for very low-level code that needs to be close to the metal (e.g. scientific code running without an OS inside scientific instruments). But in most scientific use cases, dynamic languages are just way better, as they have been the last 30 years, and Rust doesn't change that, nice as it is.
1. https://discourse.julialang.org/t/blog-post-rust-vs-julia-in-scientific-computing/101711/22?u=jakobnissen https://discourse.julialang.org/t/blog-post-rust-vs-julia-in...
2. https://discourse.julialang.org/t/blog-post-rust-vs-julia-in-scientific-computing/101711/56?u=jakobnissen https://discourse.julialang.org/t/blog-post-rust-vs-julia-in...
3. https://discourse.julialang.org/t/blog-post-rust-vs-julia-in-scientific-computing/101711/92?u=jakobnissen https://discourse.julialang.org/t/blog-post-rust-vs-julia-in...
- tnecniv 3y agoAs an aside: I do a lot of numerical research and have mainly been using python with Jax due to how trivial it is to run my code on the GPU with Jax. However, I’ve gotten increasingly fed up with Python as a language and Julia is basically my ideal language, feature wise. Do you think it’s worth the switch and, if so, is it easy to run stuff on the GPU these days? Last I checked it still required some care to do that.
- jakobnissen 3y agoI think it depends on a few things. Python are light years ahead of Julia when it comes to machine learning, so if your GPU code is that, don't pick Julia yet. Do you need a lot of niche libraries? Then maybe not: Julia has many fewer packages than Python. Also, what is your tolerance for "rough edges"? Despite Julia being 10 years old at this point I feel like I run into rough edges in Julia quite often: Underspecified behaviour of function in edge cases, a compiler whose optimisations are somewhat unreliable at producing the most efficient code, and some language nice-to-haves that are conspicuously missing such as a good linter. Nonetheless, I've found it to be better than Python for my use cases. I also hear that Julia's GPU capabilities are excellent
- vpastore 3y ago[dead]