News for hackers. Stuff that matters.
Re:Go is 17 times more sustainable than Python by Rochus on Saturday February 18, 2023 @12:39PM (#34848962)
> ChatGPT-3 is predominantly written in Python

Is it? Do you have references? Isn't all the number crunching written in C++ and "only" the orchestration in Python?

But essentially it is a reasonable view.

There were already studies about energy consumption related to programming languages, see https://www.sciencedirect.com/science/article/pii/S016764232... and https://dl.acm.org/doi/abs/10.1145/3136014.3136031.

In the 2017 version of the study Go is far behind Rust or even Java, and there is even a factor 23 (instead of 17) from Go to Python in energy consumption. So if you really want to reduce the CO2 footprint then you should rather use Rust or C++ instead of Go, where the factor is about 76.

Re:Go is 17 times more sustainable than Python by steveklabnik on Saturday February 18, 2023 @01:09PM (#34849310)
This paper is very bad. I wish people would stop citing it. There’s serious methodological flaws.

And yes I say that even though Rust performs very well in it.

Re:Go is 17 times more sustainable than Python by coldtea on Saturday February 18, 2023 @01:20PM (#34849452)
"There’s serious methodological flaws" such as?
Re:Go is 17 times more sustainable than Python by steveklabnik on Saturday February 18, 2023 @01:29PM (#34849563)
The largest one is that it is measuring benchmark game programs. There is no reason to believe that those style of programs are representative of all programs.

Furthermore, there’s very weird results as well. Why is TypeScript so much worse than JavaScript? TypeScript is a superset of JavaScript and compiles to it. The JavaScript program could be exactly the same as the TypeScript one, but isn’t for some reason.

It’s been a while and I’m on my phone so I can’t check, but IIRC the reason the above is even a question is that they made a benchmarking framework but didn’t share it, so nobody can reproduce their results.

Re:Go is 17 times more sustainable than Python by vorpalhex on Saturday February 18, 2023 @01:33PM (#34849612)
> Why is TypeScript so much worse than JavaScript? TypeScript is a superset of JavaScript and compiles to it

Typescript produces garbage JS output that creates all sorts of weird bugs, hiccups and strange quirks. It doesn't surprise me that TS generated JS would perform much worse than directly written JS.

Re:Go is 17 times more sustainable than Python by steveklabnik on Saturday February 18, 2023 @01:38PM (#34849652)
Even if you take a JavaScript file and run it through tsc, it adds stuff? That is indeed surprising to me!

It wouldn’t shock me that there were differences if you used a bunch of fancy TypeScript features, but at the limit I would expect no overhead if you don’t use any of them. Maybe that expectation is misguided.

Re:Go is 17 times more sustainable than Python by rcme on Saturday February 18, 2023 @03:31PM (#34850769)
It depends on your compiler settings but the code can very closely match equivalent JS if you want.
Re:Go is 17 times more sustainable than Python by Rochus on Saturday February 18, 2023 @04:11PM (#34851135)
These are not "serious methodological flaws"; you do not consider the results credible, which might be justified or not, it's an opinion.
Re:Go is 17 times more sustainable than Python by misnome on Saturday February 18, 2023 @03:41PM (#34850852)
We had a session at a recent biochemistry scientific software conference where someone was spending a lot of time in “more of a comment than a question” questions pushing that this paper meant that everyone should stop writing python and go back to Fortran.
Re:Go is 17 times more sustainable than Python by Rochus on Saturday February 18, 2023 @04:09PM (#34851111)
I cannot confirm your assessment. The paper has some little flaws - as all papers do - but the method and results are interesting and relevant. As with all performance measurements - or measurements in general - there is a measurement error. As engineers we have learned to cope with such errors.
Re:Go is 17 times more sustainable than Python by andrewfromx on Saturday February 18, 2023 @11:54AM (#34848407)
totally agree. It's time to re-write all the tensor flow libs in golang!
Re:Go is 17 times more sustainable than Python by melling on Saturday February 18, 2023 @12:06PM (#34848530)
Tensorflow is written in C++.
Re:Go is 17 times more sustainable than Python by andrewfromx on Saturday February 18, 2023 @12:25PM (#34848790)
hmm i mean all the stuff like numpy and a bunch of other python libs that all the deep fake audio processing stuff uses. https://pypi.org/project/tacotron/
Re:Go is 17 times more sustainable than Python by dima55 on Saturday February 18, 2023 @01:19PM (#34849427)
All of that is written in C (or C++). The Python is just the glue code. This article is fighting a straw man
Re:Go is 17 times more sustainable than Python by CactusOnFire on Saturday February 18, 2023 @01:20PM (#34849445)
Most of numpy executes in C.
Re:Go is 17 times more sustainable than Python by Xeoncross on Saturday February 18, 2023 @01:19PM (#34849442)
ah! those darn C++ devs got to it first! they're always faster /s
Re:Go is 17 times more sustainable than Python by bratao on Saturday February 18, 2023 @01:21PM (#34849460)
This is an article with a very bad conclusion. ChatGPT use of Python is just as a glue. Most of ML libs in Python are written in C++ and Rust.
Re:Go is 17 times more sustainable than Python by Xeoncross on Saturday February 18, 2023 @01:34PM (#34849621)
and even that is often the abstraction over the GPU-specific processing
Re:Go is 17 times more sustainable than Python by infogulch on Saturday February 18, 2023 @01:55PM (#34849843)
I wonder if you could count CPU cycles used to run the python parts compared to the C++/Rust parts. I bet the ratio is at least 1/1000.
Re:Go is 17 times more sustainable than Python by alex-stargazer on Saturday February 18, 2023 @01:23PM (#34849489)
They didn't even try numba to give Python a fair chance :(
Re:Go is 17 times more sustainable than Python by Aperocky on Saturday February 18, 2023 @01:30PM (#34849572)
Programming language is just frontend interface and does not determine the actual implementation/compilation or runtime.

This article is completely pointless as is.

Re:Go is 17 times more sustainable than Python by watt on Saturday February 18, 2023 @01:31PM (#34849579)
The neural network layer of GPT and their cohorts is C++. Even Rust will have hard time beating that. On glue layer you could use Go, but Python is just as good. It just does not matter!
Re:Go is 17 times more sustainable than Python by fnordpiglet on Saturday February 18, 2023 @01:32PM (#34849598)
Python uses more cycles than go in a very sloppy and unscientific analysis. Must be a slow day on HN. It doesn’t even mention rust.
Re:Go is 17 times more sustainable than Python by rg111 on Saturday February 18, 2023 @01:38PM (#34849661)
This article is worse than a joke and the writer has no knowledge and no clue about Machine Learning.

All Deep Learning libraries use C++ in the backend.

This kind of "bloggers" personifies everything that is wrong with blogging nowadays.

Re:Go is 17 times more sustainable than Python by 6gvONxR4sf7o on Saturday February 18, 2023 @02:08PM (#34849982)
This is misleading work because they chose such an unrepresentative toy model.

They essentially say that in python most of the time is spent doing python work, while in go, most of the time is spent in the math calculations. That’s only true because so little calculation happens in this toy model. Scale it up to a realistic model, and python vs go should become a rounding error.

I also take issue with the conflation of sustainability and speed.

Re:Go is 17 times more sustainable than Python by rg111 on Saturday February 18, 2023 @02:18PM (#34850096)
And they used Numpy.

They should have used pytorch or tensorflow if they knew what they were doing.

Nobody uses Numpy for Deep Learning.

Re:Go is 17 times more sustainable than Python by ilalex on Saturday February 18, 2023 @04:03PM (#34851065)

   time python min.py
  New synaptic weights after training:
  [[ 9.67300549]
   [-0.20838755]
   [-4.62931838]]
  Considering new situation [1, 0, 0] -> ?:
  [0.99993704]
  python min.py  0.35s user 1.07s system 756% cpu 0.188 total
No. Python is not 17x times slower. Author did just a irreproducible performance research.
Re:Go is 17 times more sustainable than Python by akitzmiller on Sunday February 19, 2023 @10:58AM (#34858644)
There is a bit of a forest / trees problem here. Python's simplicity is all about the barrier to computing. Because the barrier to use of Python is so much lower than for Rust, et al. you can get to a point where you've automated some human activity much more quickly or, indeed, even bothered to automate it at all. Someone knocking out a Python tool so that a manager doesn't have to gather spreadsheets every month to monitor progress is better than it not happening because Rust doesn't have the higher level libraries to make it a 5 day, 1 person project.

This article really just reads like there is some internal griping about not using Python.