Live data from Hacker News

Python consumes 38x more energy than Java

stratoflow.com

121–130 of 142 posts

Re: Python consumes 38x more energy than Java

#121
post #120
post #115

Earlier quoted context omitted.

To reduce the weight of outliers "average of ratios" and median: https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Geomean is the same; and it's less sensitive to outliers than arith. mean or median.

Geomean is the same for ratio of averages and average of ratios.

Geomean seems less sensitive to outliers than arithmetic mean and more sensitive to outliers than median.

Re: Python consumes 38x more energy than Java

#122
post #114
post #64

Earlier quoted context omitted.

True partly because shared_ptr is a relatively new language feature; I’ve been locked to a ~decade-old C++ compiler for most of my professional career, and so has everyone I know, just because support for a current compiler across platforms at any given time has been historically so spotty. It seems to be improving at the moment. > it won’t be idiomatic I just looked at the first example: C: https://benchmarksgame-te…

You seem to be looking at the wrong source code. The "Energy Efficiency across Programming Languages, SLE’17"authors provided this repo — https://github.com/greensoftwarelab/Energy-Languages/blob/ma... https://github.com/greensoftwarelab/Energy-Languages/tree/ma... For a single outlier (regex-redux) there's a 12x difference between the measured times of the selected C and C++ programs. Even so, that mostly messes up…

Did the article use the wrong link? I used the link in the article. The C++ code from your link looks the same as what I saw.

Your bottom link shows the same data I see using the link in the article: the C++ is ~50% slower on spectral-norm.

I expect that the 12x outlier is because someone did something very non-optimal in C++.

Re: Python consumes 38x more energy than Java

#123
post #93

Earlier quoted context omitted.

The banking system.

> million times a day

Another poster pointed out I was probably misremembering cobol. Either way, your example was google searches. You don't search millions of times a day so you have to be talking about backend functions? The banking system could easily hit a million function calls in a day related to you or data you care about.

Re: Python consumes 38x more energy than Java

#124
post #118

I can see C having 1.00 in table 4 in the article. But how does Python get 71.90 and JavaScript 4.45 ? Something seems off there.

JS has a JIT compiler, so for long running programs it can very well execute native machine code in the exact same way as C (plus a GC occasionally meddling with things). Also, it’s not even a bad JIT compiler, huge amount of development went into making it good.

Standard Python is interpreted all the time, going from instruction to instruction giving a layer of abstraction that never disappears.

Re: Python consumes 38x more energy than Java

#125
post #122
post #114

Earlier quoted context omitted.

You seem to be looking at the wrong source code. The "Energy Efficiency across Programming Languages, SLE’17"authors provided this repo — https://github.com/greensoftwarelab/Energy-Languages/blob/ma... https://github.com/greensoftwarelab/Energy-Languages/tree/ma... For a single outlier (regex-redux) there's a 12x difference between the measured times of the selected C and C++ programs. Even so, that mostly messes up…

Did the article use the wrong link? I used the link in the article. The C++ code from your link looks the same as what I saw. Your bottom link shows the same data I see using the link in the article: the C++ is ~50% slower on spectral-norm. I expect that the 12x outlier is because someone did something very non-optimal in C++.

Yes, the link grabbing seo claims the benchmarks game has something to say about Java and energy-efficient — in fact the benchmarks game does not measure energy use.

No, the link grabbing seo provides the correct source for Table 4 — "Source: Energy Efficiency across Programming Languages, SLE’17" — and google finds the article:

https://greenlab.di.uminho.pt/wp-content/uploads/2017/09/pap...

> looks the same

Please look again.

> the 12x outlier

    #include 
    vs
    #include 

Re: Python consumes 38x more energy than Java

#126
post #92

This is why I'm learning Rust: C# gives fast development speeds than Python with decent performance. Python and Go for when their native libraries smoke C# and now Rust for performance or low level.

Go is not generally faster than C#/Java. There are scenarios where each can come up on top.

Smoke as in have better support for specific (niche) use cases. Python has strong numeric libraries and Go has better support for modern/interesting/crazy cryptography systems than C#/Java.

So in reality there are very few places where you would want to use Go over modern C#.

Re: Python consumes 38x more energy than Java

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

Ever use BLAS or LAPACK?

Re: Python consumes 38x more energy than Java

#128
post #111
post #110

Earlier quoted context omitted.

Didn't open with ancient Excel. HTML? txt?

Must be really ancient. Here is table 4 by geomean: (c) C 1.0 (c) Rust 1.1 (c) C++ 1.1 (c) Swift 1.3 (c) Fortran 1.7 (v) Java 1.7 (c) Ada 2.1 (c) Chapel 2.3 (c) Ocaml 2.4 (v) C# 3.0 (c) Go 3.4 (c) Pascal 5.1 (v) F# 5.2 (c) Haskell 5.3 (v) Lisp 6.1 (i) Dart 7.8 (i) JavaScript 8.2 (v) Racket 8.5 (i) Hack 11.0 (v) Erlang 14.6 (i) TypeScript 22.7 (i) PHP 28.7 (i) Jruby 31.6 (i) Ruby 42.6 (i) Python 51.9 (i) Perl 60.5 (i)…

> Here is table 4 by geomean

Table 4 has 3 columns.

I can only guess that is the Energy column because the numbers don't match the calculation I made for the Time column.

Pity about https.

Re: Python consumes 38x more energy than Java

#129
post #128
post #111

Earlier quoted context omitted.

Must be really ancient. Here is table 4 by geomean: (c) C 1.0 (c) Rust 1.1 (c) C++ 1.1 (c) Swift 1.3 (c) Fortran 1.7 (v) Java 1.7 (c) Ada 2.1 (c) Chapel 2.3 (c) Ocaml 2.4 (v) C# 3.0 (c) Go 3.4 (c) Pascal 5.1 (v) F# 5.2 (c) Haskell 5.3 (v) Lisp 6.1 (i) Dart 7.8 (i) JavaScript 8.2 (v) Racket 8.5 (i) Hack 11.0 (v) Erlang 14.6 (i) TypeScript 22.7 (i) PHP 28.7 (i) Jruby 31.6 (i) Ruby 42.6 (i) Python 51.9 (i) Perl 60.5 (i)…

> Here is table 4 by geomean Table 4 has 3 columns. I can only guess that is the Energy column because the numbers don't match the calculation I made for the Time column. Pity about https.

I confused the tables, sorry.

The first list considers the time values of "Table 3" in the 2021 paper, i.e. the three CLBG algorithms.

The second list considers the time values of "Table 10" and "Table 11" in the 2021 paper, i.e. the four + five Rosetta algorithms.

I also just noticed that meanwhile they unfortunately removed the tables from the online version of the referenced paper. It's a few years ago since I looked at it.

Concerning the file format you might want to use an online service e.g. like Zamzar to convert.

Re: Python consumes 38x more energy than Java

#130
post #125
post #122

Earlier quoted context omitted.

Did the article use the wrong link? I used the link in the article. The C++ code from your link looks the same as what I saw. Your bottom link shows the same data I see using the link in the article: the C++ is ~50% slower on spectral-norm. I expect that the 12x outlier is because someone did something very non-optimal in C++.

Yes, the link grabbing seo claims the benchmarks game has something to say about Java and energy-efficient — in fact the benchmarks game does not measure energy use. No, the link grabbing seo provides the correct source for Table 4 — "Source: Energy Efficiency across Programming Languages, SLE’17" — and google finds the article: https://greenlab.di.uminho.pt/wp-content/uploads/2017/09/pap... > looks the same Please l…

Yeah so the 12x gap in regex-redux is measuring the speed of two completely different libraries, and obviously boost is what’s slow. It’s not a language difference, nor even primarily an issue with means vs medians. The issue with regex-redux is slightly more of comparing apples to oranges.

I assume you’re referring to regex-redux, but I was confused for a minute there because you linked directly to the C++ code for spectral-norm, not regex-redux, and spectral-norm doesn’t include a regex lib. I had to go looking around for the includes you’re talking about, and the Benchmarks-Game version has multiple C++ entries. There are C++ entries that use pcre, re2, and boost/regex. The C entries all use pcre except the winner, who uses pcre2.

> For a single outlier (regex-redux) there's a 12x difference between the measured times of the selected C and C++ programs.

BTW, I dont know exactly what they’re referring to there. The time ratio of the Benchmarks Game fastest C version to the slowest C++ version is over 16x. The ratios in the SLE paper of energy and run time are a bit lower than 12 but they also have only one sample, and it uses boost, so I don’t see why regex-redux with boost is useful in any perf or energy comparison other than to serve as a mild warning about using boost.

There happens to be a ratio of almost exactly 12x between the slowest C++ version (g++#3 boost) and the fastest C++ version (g++#6 - pcre2). That’s C++ vs C++. Maybe that’s what they were talking about, or maybe the perf numbers have changed out from under the commentary.

The ratio of times of the fastest C to the fastest C++ time with regex-redux is 1.4x and they both use pcre2. That seems like a more reasonable place to start.

Post reply on HN