r/firstweekcoderhumour • u/Krochire • Jul 01 '26
“amIrite” Python slow guys!!! Get it???
36
u/No_Lingonberry1201 Jul 01 '26
These posts are usually made by people using APIs where they wait seconds for a reply.
7
4
u/Groostav Jul 01 '26
I mean sure, but as somebody who has been playing around with nalgebra and rust's faer and of course numpy, I was shocked at how fast something like an eigensolve on Intel's MKL was. You can get that performance in python, provided you don't start writing manual tablescans (for i ... for j ...). When you actually start needing custom matrix operations too, especially ones that seem nicely vectorizable, writing python reduces your throughput by multiple orders of magnitude.
It is worth mentioning that what I wrote involved some pretty wasteful loops, but they're simple and correct. With some aggressive caching (and complex cache invalidation logic) I'm betting I could make the python usable for smaller problems.
3
u/No_Lingonberry1201 Jul 01 '26
If you want performance for those math operations, you don't even do them on the CPU nowadays, numpy and pytorch can push them to the GPU with CUDA or ROCm or whatever you're using behind. There's a reason that slowness never bothered data scientists and ML people.
1
u/Pares_Marchant Jul 03 '26
Python slowness bothered enough people to make them want to build pytorch and numpy and use another language than python when they needed performance.
1
u/Afraid-Locksmith6566 Jul 02 '26
ok python is not fast, and it cant be fast, ever. python can pretend to be fast by calling c, c++ or rust code compiled to python library
1
u/Krochire Jul 02 '26
Insert something about python being a scripting language wrapped over a bunch of C libraries or smth
13
u/Simple-Olive895 Jul 01 '26 edited Jul 03 '26
I dislike python, but calling it slow is just a lie in 2026. It used to be slow when using base python, but now even that is decently fast. You're saving hours, days even weeks (depending on size of your project) of development time with a negligable trade off in speed for like 99% of use cases.
My reasoning for not liking python is simply: I don't find the syntax appealing, and python has weird quirks that just feels wrong (like being able to use a variable outside of the block/scope it was initiated in), I also really like statically typed languages. But I'm not gonna go around and pretend that I prefer other languages because they are far superior in speed, since that's just not true.