Re:Making Python 100x faster with less than 100 lines of Rust
by Barrin92 on Thursday March 30, 2023 @03:48AM
(#35369419)
tbf you don't need to go to C. You could write Common Lisp or Ocaml, both academic high level languages and very performant. Hell SBCL can get you to C range performance wise while you're writing dynamic, GCed code. Sure it's a little bit more involved than learning Python but not that much if you get 50x performance for free. Prevalence of Python is really baffling to me because compute resources cost money.
Re:Making Python 100x faster with less than 100 lines of Rust
by el_oni on Thursday March 30, 2023 @08:01AM
(#35371304)
academic for CS maybe. Not so much for chemistry, biology etc. If you work in computation areas of those subjects you are more likely to know matlab, R, python and maybe Julia.
I didn't know of anybody who had done any Lisp or Ocaml in my time in academia (in chemistry, chemical engineering and biology departments), but that's just 3 universities, and i certainly didn't know everybody.
Re:Making Python 100x faster with less than 100 lines of Rust
by Yoric on Thursday March 30, 2023 @12:22PM
(#35375180)
I've known people who write OCaml for biology, but they sure looked lonely :)
Re:Making Python 100x faster with less than 100 lines of Rust
by visarga on Thursday March 30, 2023 @04:19AM
(#35369613)
It also matters if you write code to run once or to serve in production, if it is experimental or stable.
If my script takes 3s to run and 5m to write in Python, vs 0.1s to run and 3h to write in C, I finish first with Python. I can try more ideas with Python.
Re:Making Python 100x faster with less than 100 lines of Rust
by akasakahakada on Thursday March 30, 2023 @08:33AM
(#35371646)
Not even readability. Academic code is mostly unreadable. If you need example: IBM Qiskit.
Everything is just a prove of concept and no one expect anything more than that.
Re:Making Python 100x faster with less than 100 lines of Rust
by kaba0 on Thursday March 30, 2023 @09:56AM
(#35372768)
C is definitely not a good choice for this, I would hate to come back 2 days later to my computation and see “segfault” as the only output.
Re:Making Python 100x faster with less than 100 lines of Rust
by Matumio on Friday March 31, 2023 @07:41AM
(#35385542)
I'd be happy getting just a "segfault" from C. It would be so much better than subtly wrong results from reading uninitialized memory or out-of-bounds access, results that change depending on debug vs optimized build, or when changing some adjacent code.
The use case btw. is often also very different. In most of academia, writing code is basically just a fancy mode of documentation for what is basically a glorified calculator. Readability trumps efficiency by a large margin every time.