Terrible, especially when you use OO. Very clear from implementation point that it has the worst performance of all script languages. Even ruby is faster now.
mehdio: "Python is not slow". also mehdio: "When Python is slow, people write code in C++ to make something actually fast, and then call it from Python". So yeah folks, Python _is_ slow...
What's the issue with that? You start with an easy-to-learn programming language that can scale across many developers (fast development). When you need compute performance optimizations, you bring in low-level to fine-tune things. Mojo makes similar promises, but I don't think it will take off, IMO.
@@mehdio The problem is that writting python extension is absolute terrible because of this 25 year old and organically grown API. And if you want the extension feel pythonic you cant just use a simple wrapper generator.
@llothar68, do you mean terrible in terms of developer experience or terrible in terms of performance? Do you have clear examples in mind ? In the example I gave in the video, Polars, for instance, is used for heavy compute (data pipelines), and it's a relatively recent project (with its core in Rust) that works quite smoothly with the Python binding.
It's slow. Compared to fast languages, of course it's slow... You can't argue with that. The only way to make Python fast is... to use a fast language and call it from Python. So, yes, Python is slow. And more Python is hell for large projects.
I understand ur point, however what I don’t understand is how is ur point relevant to the idea of the benchmark ? The benchmark is straightforward, language runtime speed, it’s a race, yes like F1 race. It’s not about idea -> reality, it’s not about library, it’s not about right tool for right job, it is just to showcase language raw performance when all of them are trying to do the same task. So in this context, for the sake of this race, Python is slow, and it’s ok to be slow, because Python’s performance was never its strong suit.
People calling python not slow haven't worked on large python projects. For small things and scripting I would argue python is probably the fastest language to use for a no result to result time almost always. It's what I reach for every time. Especially since LLMs are optimized for python above any other language. Large python projects are something else. Oh boy. People getting sloppy and slapping in n^2 algorithms for 1000+ long element objects here and there and yeah... Python apps suddenly become unbearably slow. Even moreso on old hardware. Scaling python is too much of a hassle I've found and this is coming from someone who beat the drum of full stack python. I have switched to using exclusively go for backends and I can guarantee even an absolutely terrible go backend implementations will still be more performant and scalable than just about any python.
In practice it's fast on performance too. If you add compilation time, Rust is slower for scripts that won't be run many times. Python runs instantly without a compile step and takes advantage of libraries written in precompiled code written in other languages for anything that would be slow in pure Python, which makes the performance pretty optimal for the things it is primarily used for.
Anyone that says that python isn't slow, never had to scale it. Python is fundamentally easy to write, hard scale. Which at some point and for certain project it makes it really hard to justify on a purely software engineering perspective, since the more optimize the more you usually end up losing on a readability which is the whole point of using python in the first place, and what for? I can make a Go program in roughly the same time that will run magnitudes faster.
Check out Airflow - OSS data pipelines orchestrator tool, which is standard in the industry. It scaled at Airbnb with thousands of DAGS and I worked at Klarna on the same setup. Purely Python framework. I could go on with the list, but it really depends on what you mean by scale.
Python isn't used in AI. Python uses AI. The AI and compute portion aren't done in Python. But developers create bindings for the non dev AI researchers to call the AI libraries.
If you are compiling your core code in C++/C and calling it from extensions/dynamic libraries in Python. Python is slow and you're just being contrarian. Python like Ruby and every other scripting language that has ever existed is always slower than natively compiled code, it will never be faster. They also, while slower, have their places in the various markets and industries programmers and scripters work in. If you need to call most of your code from outside Python, the language is just a framework for you to call native code from.
What's slow is slow. No one cares about "fast syntax writing" or UX or whatever the hell because that part is subjective, when people mention speed they obviously relate to execution speed.
What's your experience with Python's performance ? Love or hate ?
Terrible, especially when you use OO.
Very clear from implementation point that it has the worst performance of all script languages. Even ruby is faster now.
mehdio: "Python is not slow".
also mehdio: "When Python is slow, people write code in C++ to make something actually fast, and then call it from Python".
So yeah folks, Python _is_ slow...
What's the issue with that? You start with an easy-to-learn programming language that can scale across many developers (fast development). When you need compute performance optimizations, you bring in low-level to fine-tune things. Mojo makes similar promises, but I don't think it will take off, IMO.
@@mehdio The problem is that writting python extension is absolute terrible because of this 25 year old and organically grown API. And if you want the extension feel pythonic you cant just use a simple wrapper generator.
@llothar68, do you mean terrible in terms of developer experience or terrible in terms of performance? Do you have clear examples in mind ?
In the example I gave in the video, Polars, for instance, is used for heavy compute (data pipelines), and it's a relatively recent project (with its core in Rust) that works quite smoothly with the Python binding.
The title should be "Most of the time, Python being slow does not matter". That said, it is slow.
It's slow.
Compared to fast languages, of course it's slow... You can't argue with that.
The only way to make Python fast is... to use a fast language and call it from Python.
So, yes, Python is slow.
And more Python is hell for large projects.
I understand ur point, however what I don’t understand is how is ur point relevant to the idea of the benchmark ? The benchmark is straightforward, language runtime speed, it’s a race, yes like F1 race. It’s not about idea -> reality, it’s not about library, it’s not about right tool for right job, it is just to showcase language raw performance when all of them are trying to do the same task. So in this context, for the sake of this race, Python is slow, and it’s ok to be slow, because Python’s performance was never its strong suit.
People calling python not slow haven't worked on large python projects. For small things and scripting I would argue python is probably the fastest language to use for a no result to result time almost always. It's what I reach for every time. Especially since LLMs are optimized for python above any other language.
Large python projects are something else. Oh boy. People getting sloppy and slapping in n^2 algorithms for 1000+ long element objects here and there and yeah... Python apps suddenly become unbearably slow. Even moreso on old hardware. Scaling python is too much of a hassle I've found and this is coming from someone who beat the drum of full stack python. I have switched to using exclusively go for backends and I can guarantee even an absolutely terrible go backend implementations will still be more performant and scalable than just about any python.
So to resume : Python is fast to write but slow in performance. It just depends on the project
In practice it's fast on performance too. If you add compilation time, Rust is slower for scripts that won't be run many times. Python runs instantly without a compile step and takes advantage of libraries written in precompiled code written in other languages for anything that would be slow in pure Python, which makes the performance pretty optimal for the things it is primarily used for.
going for a walk from bed to kitchen isnt slow aswell.
now try to walk 40Km to the city and call it fast :D
Anyone that says that python isn't slow, never had to scale it. Python is fundamentally easy to write, hard scale. Which at some point and for certain project it makes it really hard to justify on a purely software engineering perspective, since the more optimize the more you usually end up losing on a readability which is the whole point of using python in the first place, and what for? I can make a Go program in roughly the same time that will run magnitudes faster.
Check out Airflow - OSS data pipelines orchestrator tool, which is standard in the industry. It scaled at Airbnb with thousands of DAGS and I worked at Klarna on the same setup. Purely Python framework.
I could go on with the list, but it really depends on what you mean by scale.
Python isn't used in AI. Python uses AI. The AI and compute portion aren't done in Python. But developers create bindings for the non dev AI researchers to call the AI libraries.
If you are compiling your core code in C++/C and calling it from extensions/dynamic libraries in Python.
Python is slow and you're just being contrarian.
Python like Ruby and every other scripting language that has ever existed is always slower than natively compiled code, it will never be faster.
They also, while slower, have their places in the various markets and industries programmers and scripters work in. If you need to call most of your code from outside Python, the language is just a framework for you to call native code from.
What's slow is slow. No one cares about "fast syntax writing" or UX or whatever the hell because that part is subjective, when people mention speed they obviously relate to execution speed.
I am with you bro