3 ms·
> Fast - in many cases faster than Rust, although the difference is inconsequential relative to Python-to-Rust improvement I guess. Do you have any examples? A
by vlovich123 4y ago
> Fast - in many cases faster than Rust, although the difference is inconsequential relative to Python-to-Rust improvement I guess.
Do you have any examples? AFAIK properly tuned rust and c++ will perform largely the same. Actually, Rust should have a bit of an edge due to the prohibition of aliasing. In practice it can vary if a standard library implementation is suboptimal or the compiler has suboptimal codegen into Bitcode but that’s generally going to be rare these days I think.
> Richer offering of libraries for various needs than Rust, for you to possibly utilize.
Are you talking for computational chemistry specifically or general libraries?. Don’t know about the former. For the latter I’ve found not only are more interesting libraries available, there seem to be generally high quality versions. Additionally, “cargo add xxx” is infinitely faster than integrating some random third party c++ dependency. Not to mention that C++ falls on the floor if one dependency requires transitive dependency X and another (or you) requires X at an incompatible version? Rust handles that elegantly where two different modules can depend on the same package at different versions without conflict without you needing to worry about it beyond the size of the executable.
> Easier to share than Rust. A target system is less likely to have an appropriate version of Rust and the surrounding ecosystem.
Again, haven’t that found to be my experience. Rustup lets you obtain any version of the rust tool chain, no muss no fuss. Additionally, it does a phenomenal job of not worrying about which compiler vendor you’re using (there’s only one) and more importantly there’s no versioning issues with libraries written against an older version of the language - 2021 and 2018. Oh, if you’re on windows, you also don’t have to worry about whether the target person has the right c++ runtime library version installed. With rust they just run the exe.
- Const-me 4y ago> not only are more interesting libraries available, there seem to be generally high quality versions I wonder what's an equivalent of Eigen? https://eigen.tuxfamily.org/index.php?title=Main_Page https://eigen.tuxfamily.org/index.php?title=Main_Page > if you’re on windows, you also don’t have to worry about whether the target person has the right c++ runtime library version installed It's usually easy to build such binaries for Windows. That's a single combobox in project settings. Here's an example, just running the .exe works: https://github.com/Const-me/Whisper https://github.com/Const-me/Whisper
- vlovich123 4y ago> I wonder what's an equivalent of Eigen? 2 seconds on Google yields: https://www.nalgebra.org/ https://www.nalgebra.org/ https://rust-lang-nursery.github.io/rust-cookbook/science/mathematics/linear_algebra.html https://rust-lang-nursery.github.io/rust-cookbook/science/ma... https://docs.rs/GSL/latest/rgsl/ https://docs.rs/GSL/latest/rgsl/ I have no idea the quality but you’ve also got bindings to more mature libraries: https://docs.rs/lapack/0.14.1/lapack/ https://docs.rs/lapack/0.14.1/lapack/ And https://www.erikpartridge.com/2019-03/rust-ml-simd-blas-lapack https://www.erikpartridge.com/2019-03/rust-ml-simd-blas-lapa... is an overview from t years ago and does say it’s maybe not as good although not sure how much has changed in that time (eg has nalgebra matured sufficiently?) It’s possible that Rust is lacking in good linear algebra libraries. I’m not as familiar with that space.
- einpoklum 4y ago> Do you have any examples? AFAIK properly tuned rust and c++ will perform largely the same. In principle, Rust has some overhead for being "safe", which C++ does not. Also, C++ benefits for longer period of time and more people working on optimizing its libraries and compilers. > Are you talking for computational chemistry specifically or general libraries? Ah, indeed, no. I have no idea which chemistry libraries are available for Rust and for C++. I was referring to scientific computing, algebra and other heavy-lifting work. > Additionally, “cargo add xxx” is infinitely faster than integrating some random third party c++ dependency. That's not one of OP's criteria. But - seeing how you like package managers, try `conan install /path/to/srcdir` from the build directory. For more details, read: https://docs.conan.io/en/latest/getting_started.html https://docs.conan.io/en/latest/getting_started.html > Not to mention that C++ falls on the floor if one dependency requires transitive dependency X and another (or you) requires X at an incompatible version? C++ is a language, it doesn't have dependency management. As for libraries, that situation is so rare - in my experience - that a chemistry person should not even be bothered to consider it. > haven’t that found to be my experience. Well, I learned something new today... I didn't know about rustup. Was it introduced recently?
- vlovich123 4y ago> In principle, Rust has some overhead for being "safe", which C++ does not. Also, C++ benefits for longer period of time and more people working on optimizing its libraries and compilers. Do you know of any specific safety features that makes rust slower? About the only one I can think of at runtime is that everything is bounds checked but that’s usually fixable in many ways (and technically c++ has that too except it’s applied randomly based on subtitle API differences like [] isn’t but .at is). As for quality of the standard library it’s hard to say. I haven’t found it to be bad. The HashMap implementation is better out of the box, a Vec/vector doesn’t really have anything special. File system APIs, error handling, modules, and async all feel more mature and polished (not performance per se but just overall completeness of the language). What is on your mind when you say that the c++ standard library is higher quality? Oh, and which of the three major implementations are you referring to? The compilers story is actually even better because very little optimization happens in the frontend and thus a lot of the optimizations done for c++ apply to rust too. One specific way the language itself is better is that it disallowed aliasing so it’s closer to Fortran for numerical stuff and there’s various optimizations that c++ just can’t do. If I recall correctly that hasn’t been fully hooked up to the compiler due to bugs in LLVM but that will get resolved eventually. Overall, I’m not familiar with the claim that Rust code compiles worse than c++. About the only thing I’ve run into so far is bound checking showing up in hotspot code that I wrote non idiomatically because I’m still new to the language. > Well, I learned something new today... I didn't know about rustup. Was it introduced recently? 1.0 is 6 years ago so not recent at all (not sure if there were pre 1.0 releases too): https://www.reddit.com/r/rust/comments/5iqsmg/rustup_100_is_here https://www.reddit.com/r/rust/comments/5iqsmg/rustup_100_is_...