News for hackers. Stuff that matters.
Re:From Erlang to Lunatic by vegabook on Saturday February 18, 2023 @03:11PM (#34850566)
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.
Re:From Erlang to Lunatic by jerf on Saturday February 18, 2023 @03:22PM (#34850673)
Be 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.

Re:From Erlang to Lunatic by Thaxll on Saturday February 18, 2023 @03:13PM (#34850586)
Then 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.

Re:From Erlang to Lunatic by Conscat on Saturday February 18, 2023 @03:20PM (#34850655)
You could use Nim.
Re:From Erlang to Lunatic by Scramblejams on Saturday February 18, 2023 @03:24PM (#34850694)
Yes, there are a lot of options, though it gets less mainstream pretty quick. Fortran, Ada/Spark, Ocaml, for a few other examples.
Re:From Erlang to Lunatic by Thaxll on Saturday February 18, 2023 @03:50PM (#34850942)
Those 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.
Re:From Erlang to Lunatic by Scramblejams on Saturday February 18, 2023 @11:30PM (#34854423)
Right, which is why I said “gets less mainstream,” meaning that the examples listed were not mainstream. Apologies if that was unclear.
Re:From Erlang to Lunatic by ilovecaching on Saturday February 18, 2023 @03:29PM (#34850750)
That'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.

Re:From Erlang to Lunatic by vvanders on Saturday February 18, 2023 @03:46PM (#34850907)
At 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.

Re:From Erlang to Lunatic by ryloric on Saturday February 18, 2023 @04:01PM (#34851052)
This feels like a nano optimization to me.
Re:From Erlang to Lunatic by lenkite on Sunday February 19, 2023 @06:05AM (#34856511)
The 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.