Live data from Hacker News

Python consumes 38x more energy than Java

stratoflow.com

21–30 of 142 posts

Re: Python consumes 38x more energy than Java

#21
post #12
post #4

Even more clickbaity title would have been "Python consumes 70x more energy than Rust"

Everything consumes more energy than C

Sometimes I wonder if that's true long term. The amount of bugs, security issues, and code churn surrounding C code bases is pretty wild. If everybody and all their deployments has to recompile a C code base 100 times over the course of three years to get patches, fixes, etc it makes me wonder what the real cost of C is?

My intuition states that this isn't the case, but intuition can be wrong.

Re: Python consumes 38x more energy than Java

#22
post #3

The actual benchmark: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... EDIT: fwiw, classic Fortran is twice as fast as java :P As is Rust, but that's less funny to me

Thanks for this link.

They also seemed to have avoided libraries like numpy.

In my mind, python made it possible to hardware optimize with libraries like numpy quite easily. Avoiding it is a mistake. I'll try to see if I have time to play the game myself and throw my attempt in there.

Re: Python consumes 38x more energy than Java

#23

One should always be skeptical of these sorts of benchmarks, especially against Java, and I say this as primarily a Java developer. Well optimized Java is very lean and can be incredibly performant, but the median modern Java app is an obese cronenberg made out of gigabytes of SpringBoot dependencies. That's not particularly fast; and well optimized python will run circles around it.

You seem to be conflating speed and memory usage. A spring boot app will generally be very performant. It will indeed use more memory though.

I did an excercise some time ago and managed to get two file transfer apps, one in Rust and one in Java, where the performance was effectively the same (in some cases with a slight Java edge!), but the memory consumption was orders of magnitude in favor of Rust. The JVM is a wonder of engineering, and Java is indeed quite fast.

Re: Python consumes 38x more energy than Java

#25
post #12

Earlier quoted context omitted.

Everything consumes more energy than C

Sometimes I wonder if that's true long term. The amount of bugs, security issues, and code churn surrounding C code bases is pretty wild. If everybody and all their deployments has to recompile a C code base 100 times over the course of three years to get patches, fixes, etc it makes me wonder what the real cost of C is? My intuition states that this isn't the case, but intuition can be wrong.

Most people don't run Gentoo so binaries are only compiled once.

Re: Python consumes 38x more energy than Java

#26
post #4

Even more clickbaity title would have been "Python consumes 70x more energy than Rust"

Yea but it's HN you can't mention Rust just being rust without a bunch of people losing their minds over the fact that someone said "Rust".

"We are the knights who say Rust!"

Re: Python consumes 38x more energy than Java

#27
post #3

The actual benchmark: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... EDIT: fwiw, classic Fortran is twice as fast as java :P As is Rust, but that's less funny to me

Thanks for this link. They also seemed to have avoided libraries like numpy. In my mind, python made it possible to hardware optimize with libraries like numpy quite easily. Avoiding it is a mistake. I'll try to see if I have time to play the game myself and throw my attempt in there.

But isn't what makes numpy efficient written in C?

Re: Python consumes 38x more energy than Java

#28
post #3

The actual benchmark: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... EDIT: fwiw, classic Fortran is twice as fast as java :P As is Rust, but that's less funny to me

Fortran is a beast. People crap on it all the time yet use it often millions of times a day without realizing it.

> Fortran is a beast. People crap on it all the time

I think most of the people who "crap on" Fortran, when they say "Fortran", mean FORTRAN 77, not Fortran 2018

Re: Python consumes 38x more energy than Java

#29
post #3

The actual benchmark: https://benchmarksgame-team.pages.debian.net/benchmarksgame/... EDIT: fwiw, classic Fortran is twice as fast as java :P As is Rust, but that's less funny to me

Fortran is a beast. People crap on it all the time yet use it often millions of times a day without realizing it.

I don't think Fortran gets beaten up that much, it's just sort of ... ignored
Post reply on HN