4 ms·
Here in Europe I'm thinking of using more Rust simply for power efficiency. If it's twice as fast as, say, Go, then it's using half the (incremental) power. Tha
by vegabook 4y ago
Here in Europe I'm thinking of using more Rust simply for power efficiency. If it's twice as fast as, say, Go, then it's using half the (incremental) power. That's non trivial now that energy is a serious cost consideration of computing.
- Thaxll 4y agoThen you can't use anything else than C/C++/Rust with that argument. Also the twice as fast therefore using twice less power is wrong.
- Conscat 4y agoYou could use Nim.
- Scramblejams 4y agoYes, there are a lot of options, though it gets less mainstream pretty quick. Fortran, Ada/Spark, Ocaml, for a few other examples.
- Thaxll 4y agoThose are not mainstream language, they probably lack libraries for most common use case, also most likely not as fast as Rust and probably even Go.
- Scramblejams 4y agoRight, which is why I said “gets less mainstream,” meaning that the examples listed were not mainstream. Apologies if that was unclear. But you'd be wrong about your speed guesses. Ada/Spark and Fortran can be incredibly fast. Much of the world's fastest numerical code is written in Fortran, for example. (OCaml can be super quick too, though it can take a bit of care, and I get the feeling they've fallen behind in compiler tech in recent years.)
- jerf 4y agoBe sure to do the math. A lot of programs use negligible power. If you spend an hour more writing your program, with your computer on during that time, you may find it can take you literally years to recover that. In fact it's not hard for it to take centuries or worse. Programming spans a lot of orders of magnitude. If you're writing code for a multi-hundred system cluster, then by all means consider energy consumption. But it's also easy to spend hours, days, weeks to save a net total of several milligrams of CO2, because your program won't even spend as long in its total life time executing as you spent writing it, in which case the costs of execution are actually less that the development.
- ilovecaching 4y agoThat's not how that works. Rust can actually make power usage worse because it generates larger code sizes which causes more I-cache churn and thus more power usage. Making efficient use of caches, power states, and reducing polling are all things that you don't just get for free because "I'm using Rust and Rust is efficient". Rust lets you write something efficient after you've spent tons of time working on making it efficient and understanding how power is consumed on a particular platform for a particular app. Once again, you could just use a language where they do this for you in the runtime instead of trying to reinvent (probably poorly) these ideas yourself.
- vvanders 4y agoAt least on mobile SoCs that's exactly how it works, in fact due to how dynamic frequency scaling works it can be worse than 2x because to run at a higher frequency you need to run at a higher voltage. Your frequency increases(which drive switching costs) and you're paying more per current due P=IV. You're right in that not running the workload if possible is the best power savings but if you can't do that moving it to more efficient usage is a good way to make large inroads on power usage.
- ryloric 4y agoThis feels like a nano optimization to me.
- lenkite 4y agoThe rust compiler has a serious energy cost though.Also due to lack of (proper) standard library, downloading thousands of crates is pretty expensive. If you use CICD, cargo+rustc is gonna burn through your energy budget VERY quickly.