Live data from Hacker News

Python consumes 38x more energy than Java

stratoflow.com

31–40 of 142 posts

Re: Python consumes 38x more energy than Java

#31

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.

You should get your hands on say, go and go-fiber, and compare that with spring boot regarding speed and memory. And I say that with our main backend being kotlin/java and spring boot. It's a nightmare and absolute and utter garbage.

Re: Python consumes 38x more energy than Java

#32

Earlier quoted context omitted.

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?

Everything that makes Python efficient is written in C or C++ or the like. Python in these situations is just a glue language (with an optional interactive layer) that makes using these libraries more feasible.

Re: Python consumes 38x more energy than Java

#33
Just write in Rust, it's easier to build good software than either of these languages (yea, yea, do you data analyst stuff in python until you start using POLARS). At this point it's a far superior ecosystem from a developer experience point of view and the fact it's going to get you as close to efficient as possible without you thinking too far into it is a welcome side effect.

Using VScode with the Sqlx package I get compile time errors on my SQL - as a result I haven't ran a binary with a typo from my SQL in the last 12 months.

Re: Python consumes 38x more energy than Java

#34
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.

If your web service runs with numpy, excellent.

Re: Python consumes 38x more energy than Java

#35

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.

No man spring boot is hideously slow as well compared to vanilla java. It's pretty fast compared to many other things, but that's just because vanilla java is extremely fast.

You often see like 15-30 second start times for springboot apps, which is hilarious and 13-28 seconds longer than it has any business taking.

Re: Python consumes 38x more energy than Java

#36

Just write in Rust, it's easier to build good software than either of these languages (yea, yea, do you data analyst stuff in python until you start using POLARS). At this point it's a far superior ecosystem from a developer experience point of view and the fact it's going to get you as close to efficient as possible without you thinking too far into it is a welcome side effect. Using VScode with the Sqlx package I g…

Do you use an extension other than just `rust-analyzer` in order to get compile-time errors for SQL with sqlx?

Re: Python consumes 38x more energy than Java

#37
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.

use in what ?

I severely doubt anything I do touches fortran millions times a day unless it's google search that runs on it.

Re: Python consumes 38x more energy than Java

#38

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.

This is an important point, real life performance looks nothing like benchmarks in most cases. From my personal experience: benchmarks showed Jruby was MUCH MUCH faster the 'normal' Cruby. But try running a basic rails application on jruby and it's 10-100x slower, even after minutes of repeating the same request. (disclaimer, this was a few years back and purely anecdotal)

"Artificial tests produce artificial results".

Re: Python consumes 38x more energy than Java

#39
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.

As a Fortran user, it's pretty awful for string handling. It's fine for numerics. However, there's a lack of libraries for non-numeric stuff (e.g. data structures). The free compilers are buggy, too.

Re: Python consumes 38x more energy than Java

#40
post #37

Earlier quoted context omitted.

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

use in what ? I severely doubt anything I do touches fortran millions times a day unless it's google search that runs on it.

Your weather report
Post reply on HN