News for hackers. Stuff that matters.
Re:The computers are fast, but you don't know it by p1esk on Friday June 17, 2022 @02:22AM (#31774702)
Why should I care what Numpy is written in? All I see is Python.
Re:The computers are fast, but you don't know it by easytiger on Friday June 17, 2022 @03:26AM (#31775133)
Because it is like saying you use a bash script to configure and launch a c++ application and saying it is a bash script. Python is not a high performance language, it isn't meant to be and it's strengths lie elsewhere. One of it's great strengths is interop with c libs.

Your assertion was that numpy etc will be faster than something else despite being python:

> Try writing a matmul operation in C++ and profile it against the same thing done in Numpy/Pytorch/TensorFlow/Jax. You’ll be surprised.

I mean TensorFlow is c++/cuda!

Re:The computers are fast, but you don't know it by p1esk on Friday June 17, 2022 @04:12AM (#31775433)
I mean TensorFlow is c++/cuda!

No. When I write Tensorflow code I write Python. I don’t care what TF does under the hood just like I don’t care that Python itself might be implemented in C. Though I got to say TF is quite ugly and not a good example of Python’s user friendliness. But that’s another topic.

Re:The computers are fast, but you don't know it by gpderetta on Friday June 17, 2022 @06:00AM (#31776093)
But as soon as you step out of the optimized path, the performance cliff is huge. Also you are forced to work in non idiomatic awkward meta-languages.
Re:The computers are fast, but you don't know it by easytiger on Friday June 17, 2022 @05:35AM (#31775958)
As long as you know python is doing little to no computational work.
Re:The computers are fast, but you don't know it by necovek on Friday June 17, 2022 @06:40AM (#31776314)
That's a known and widely publicised trait of Python.

In the early days, Python tutorial warned against adding to strings by doing "+" even though it works because that performed a new allocation and string copy.

What you were asked to do was use fast, optimized C-based primitives like "\n".join(list_of_strings) etc.

Basically, Python is an "ergonomic" language built in C. Saying how something is implemented in C at the lower level is pointless, because all of Python is.

Yes, doing loops over large data sets in Python is slow. Which is why it provides itertools (again, C-based functions) in stdlib.