68

One of my fav Python writeups. I love Python and luckily I get to dictate how it's being written in my job, so I'm forcing types down the through of my colleagues. Saved a bunch of debugging time, so I can waste more time on Lemmy while still getting paid. Good shit

you are viewing a single comment's thread
view the rest of the comments
[-] vzq@lemmy.world 2 points 1 year ago

My main issue is that you’re going through all that trouble and still get Python-level performance.

I really like Python, but there are better typed languages out there. Also, faster ones.

[-] mwguy@infosec.pub 3 points 1 year ago

How true is that still? I know python 3.2/3.4/3.6 there were significant performance issues on simple pieces of code. But python 3.9/3.11 have been significantly faster. I imagine I could write faster C++ code, but I definitely couldn't write it nearly as fast or nearly as readable.

[-] vzq@lemmy.world 0 points 1 year ago* (last edited 1 year ago)

Python has gotten faster, but it’s still nowhere near what you expect from traditional compiled languages. It can’t be.
The trick to writing performant Python code is to get good (native) libraries and let it handle the heavy lifting.

For performance sensitive stuff, the fact that pure Python is very slow really matters. For stuff that’s not performance sensitive (that is, 99% of the code out there) it doesn’t really matter, but even then it’s better to be fast than to be slow.

Now this is not something I would ordinarily have a problem with. I use Python for a reason and it’s not performance. But if I end up writing Python like it’s rust, I might as well do rust and reap the (massive!!!) performance and memory profile benefits too while I’m at it.

[-] mwguy@infosec.pub 1 points 1 year ago

Python3.10 was ~27x slower than Compiled C++ in this benchmark. Python 3.11 dropped that down to 17x just out of the box. Additionally, you can always write a python module in C or C++ to get the benefits of compilation. With the maintainability and flexibility of python.

load more comments (1 replies)
this post was submitted on 16 Aug 2023
68 points (92.5% liked)

Python

6145 readers
3 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

October 2023

November 2023

PastJuly 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS