The default implementation of Python is CPython. It's always been byte code running C written machine code. There's even Cython to write Python that compiles into C code.
Yeah, it's great for that. I built an automated video test system for Comcast back in 2018 that was heavily-threaded C++ code with a Pybind11 API to send requests and retrieve responses to the backend. The system was responsive in real time as long as you didn't saturate the image recognition thread pool.
Youre known for being a wrapper for the C/C++ applications real developers used to make Machine Learning, you goddamn hack (Ive recently had to start maintaining a python microservice and I'm getting real heated about how shit python is)
The Python script was ready week ago, took 5 minutes. Rust programmer first took 3 days to tell EVERYONE how much better it will be in Rust, then started coding and got bogged down for 2 days in a forum discussion on how to best secure memory for a "hello world!" string.
Meanwhile the Julia developer was done a week ago like the Python developer. Took 5 minutes all the same, and it ran faster than the eventual Rust implementation. No one gave a flying shit and used the Python implementation anyways because it's more familiar.
Comparing a language that gets compiled into native machine code to a language that typically compiles to and interprets byte code at runtime. Is there a point to this meme?
This sub has always been mainly posted to by first-year cs majors who spew out the same unfunny memes ad infinitum. OP likely just heard about either python or Rust for the first time and thought it would be funny to repost a meme about rust being faster than python.
I wonder /r/ConstructionWorkerHumor would be full of first year mechanical engineering students, who try to flex on each other for using a superior type of drill or hammer.
It's true but I find it way more annoying that every post has someone in the comments complaining that the humor is too common denominator. It's based on upvotes, of course the top posts will be the ones that most people can understand. The math memes sub has the same issue, every thread has a critic.
Plus why bring the mood down? I suspect some of the complainers feel validated by criticizing newer people.
I would say that the problem isn't that it is common denominator; it's that it's a sortof uninteresting take.
Sometimes, the speed of execution is important and you need to use a lower-level language to achieve that. More often--at least in my experience--the speed benefit is minor compared to the increased effort & complexity that going to a lower-level language would entail.
If your code is going to spend 99+% of its wall time waiting around for stuff to happen, going a millisecond faster in those few instances where it needs to do something probably isn't going to matter. In those cases, using a language with higher expressiveness (i.e., one that takes fewer lines of code to accomplish the same task) is a perfectly rational decision.
Nuance isn't best expressed in meme form, of course, but the sentiment in the top level meme feels like it'd fit well as the center of a bell-curve meme where the ends are "python's fine for most stuff".
I got fileted once upon a time over NFA/DFA here. Kid just took his very first combinatorics class, and the schmuck in me wanted to give him a high five but my tail was too far between my legs after the three paragraph dissertation.
When it is treated as just a scripting language (having python confugure and run compiled bytecode) the performance increases by about 100 times.
The main issue is there are lots of devs who try to do EVERYTHING in Python which causes the application to be way slower than they would be if native bytecode.
The main advantage of Python is it is quick to build stuff in.
Generally when you have a problem you need to pick and use the right tool for the job. Most developers don't learn that until senior year or their first few years in the workforce.
For one-off scripts and batch jobs, where the run time is whatever but the implementation time is the actual cost, Python usually wins out anyway. While other languages are significantly faster, the time it takes to write the same code is orders of magnitude more.
That said, in the age of LLMs this point becomes a bit moot anyway. You can easily write something in Python, verify that it's correct, then ask an LLM to rewrite it in Rust or whatever if performance is an issue. Just need a method to verify that the programs are semantically equivalent.
the compilation vs interpretation difference is honestly not as big as between the language semantics making the program include information on static value types with fixed sizes, in contiguous memory vs chains of references to "objects" with boxing required even for things like numbers, each with a vtable, stored in non-homogeneous containers. so, as u/frivol mentioned, its more about the type system (or, the type system up to the degree as to which it can be pessimistically, with 100% sureness, be used by the implementation) and the data layouts that the type system (and more generally the information provided by "definitions" in the program, and the assumptions that can be made about it, e.g. "closed system", immutability) results in. python functions could be overriden at any point by an outside module loaded dynamically, and the implementation has to consider that as "standard behavior", so it cant "just inline the function", specially if its generic but cant be monomorphized since the type of the argument isnt known for certain even if its typehinted since it could either not be consistent with the typehint, or be a subclass with an overriden method (and python methods dont even need to marked virtual, its just duck typing all over).
I think python and rust are more alike than most languages. The defining similarity is that people try to do things in both languages that should not be done in them.
ITT people who write code for a living or as a hobby seemingly unable to grasp that programming languages have use-cases and are rarely if ever universally applicable.
One of my favourite learning experiences was writing C code to read a .txt file, and return the average number of letters per word.
We couldn’t use any libraries except the standard input/output library, so I’m reading stuff character by character, storing it in my own custom-built linked list, make sure there aren’t any memory leaks…
And the next lesson started by showing us how to accomplish the same task with 10 lines of Python code.
And you wanna know which one was faster? Well, as far as my human perception could tell, both of them ran instantly. I mean, sure, technically the compiled code written by the comp sci PHD was a tad faster, but who actually gives a shit?
There’s a reason C++ isn’t used for data analysis. (Or why Python isn’t used for video games for that matter.)
I think for the case of data science, the cost of writing something wrong is more costly than the slow speed. And a good thing is everyone have a agreed way of doing the methods, with the public library.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ctype.h>
typedef unsigned long ulong;
int countWordChars(FILE *fp, ulong *words, ulong *sum)
{
char buffer[4096];
bool inWord = false;
size_t read;
while ((read = fread(buffer, 1, sizeof(buffer), fp))) {
for (int i = 0; i < read; ++i) {
unsigned char c = buffer[i];
if (isspace(c)) {
*words += inWord;
inWord = false;
} else {
++*sum;
inWord = true;
}
}
}
*words += inWord;
return ferror(fp);
}
int main(int argc, char **argv)
{
ulong words = 0;
ulong sum = 0;
for (int i = 1; i < argc; ++i) {
FILE *fp = fopen(argv[i], "r");
if (fp == NULL) {
perror(argv[i]);
return 1;
}
int err = countWordChars(fp, &words, &sum);
fclose(fp);
if (err) {
perror("Read error");
return 1;
}
}
if (words == 0) {
puts("NaN");
} else {
printf("%f\n", (double)sum / words);
}
}
#!/bin/python
import sys
words = 0
chars = 0
for filename in sys.argv[1:]:
with open(filename) as f:
for line in f:
for word in line.split():
words += 1
chars += len(word)
print(chars / words if words else "NaN")
~ $ du -h yes
862M yes
~ $ time ./a.out yes
3.000000
real 0m3.555s
user 0m2.748s
sys 0m0.538s
~ $ time ./words.py yes
3.0
real 1m25.753s
user 1m24.416s
sys 0m0.613s
people is also unable to grasp "language efficiency" is way less relevant than what they think it is
in modern CPUs a single RAM lookup consumes 200+ CPU cycles just waiting for the response, let alone a network request querying a disk on a server somewhere (I'm looking at you fragmented microservices)
that kind of architectural optimization is way more important than "I'm using C because JavaScript is less efficient"
Python is slow but that's not a problem for a scripting language which is used for data pipelines, prototyping, and teaching coding basics to high schoolers. No one sane is using it where performance matters, like microservices. Oh, wait.
If the speed of Python is, in any situation, your bottleneck, you’re doing something stupid. The large majority of all modern code is IO bound, not compute bound, and if you’re doing compute intensive work, pandas, scipi, tensorflow, google OR tools, and a number of other libraries exist to do it properly, and if none of those work, writing C code with a wrapper for Python isn’t hard. There’s boilerplate and considerations, but there are lots of tutorials and it isn’t mechanically difficult to do.
Python has issues, but if you’re complaining about Python and aren’t focused primarily on the awful state of Python package management, you don’t know enough about Python to make jokes about it.
If you factor in the cargo build time of compiling 200 crates down the dependency chain, Rust will probably start speaking only after Python has said hello and goodbye.
Python can be lightning fast when you use the right libraries. Obviously it's written in c++ or something on the back end, but it's still python being written by the end user.
Especially when you factor in development time vs execution time. It's super quick to develop in compared to many languages, and you can always come back and optimize specific slow things down the road if you have bottlenecks.
I think it's because Python while easy to write, it's ecosystem feels completely braindead at times because of all the abstraction layers. As someone who transitioned to Python from writing native C, the amount of thought taken away from me gets irritating.
Take variables for example, writing variables without an explicit type feels messy (I know you can do type declaration but that's more of a bandaid fix). Then I'm genuinely not a fan of the "Pythonic way to code". It's oversimplified and makes critical thinking feel like slop.
The dynamic-but-also-not-dynamic typing is fucking infuriating. It makes it so you need to check for types manually anyway, and dealing with user input is a hassle.
got recommended to me in my home feed (cause I switched to linux like 8 months ago) and I still kinda found it funny so i stayed
For a little more context: I tried picking up programming back when I was like 7 and stuck with it for nearly 5 years. by then, I was really burnt out, and realized it wasnt my thing.
Comparing the speed of a dynamic interpreted language to a static one that compiled machine code.. Let's next make a joke about how much faster a car is that a horse.
Mehh, this really depends on what you are doing. I took a monster spreadsheet that we use for design calcs. Essentially, it's a bunch of linear algebra and some optimization routines; it took 10+ seconds to update the sheet every time you changed a single input. I moved it over to Python with a mix of numpy and scipy, nothing fancy, just basic stuff, that got it down to under a second (~100s ms). Then I went to pure functions with Numba njit, which got me down to the 10s of microseconds range. I doubt going from njit to something like Rust or C would be any faster. Maybe for non math dominated tasks it might be different, but for me numpy/scipi or numba is as fast as possible, without having to spend crazy amounts of time on it.
Python is only really slow if you have no idea how to use it. Sure it’s never going to beat compiled lower level languages like rust or cpp, but if you use and build proper libraries for your application in python it’s often a lot closer in performance than most people think
I one wrote a Rust project which called a Python server and I had a variable called PYTHON_SKILL_ISSUE_DELAY, because otherwise python could just not keep up
The python server was part of the project and running on the same machine without rate limiting, but the rust program called it twice in a row, which it couldn't handle
You cannot have a server without rate limiting even in local. Any webserver you setup with python still will have a default limit on concurrency. Depending on the library you used, you can configure a number for how many requests you want the server to handle at a time. Anything exceeding this number will get rejected. This is different from user level rate limiting. You can handle thousands of req/s given that your config and machine can handle it. What you described sounds like a fault in your setup or you don't know how to work with python.
Shall we conveniently forget that rust gets compiled for eternity? Also make rust icon bigger.
I've made tools that prevents running `rm /tmp` etc and runs $0.unsafe if args are not sus, it takes ~10 times more space than core-utils' rm. And it's lucky day if you try to make something with bevy and endup without wasting many gigabytes.
fixing legacy python scripts is hell because you spend more time waiting for pip install than actually coding. meanwhile rust devs brag about their borrow checker saving them from segfaults while i stare at a yaml indentation error for three hours. shit world we live in where runtime errors are preferred over compile-time anxiety. i just want my code to run fast enough to close my laptop before battery dies
I would be shocked if PyPi doesn't have a print string intrinsic. Also would assume the string copy dwarf the function call overhead. So they'd do similar work in practice. I assume Python immediately drops to a more native layer to print to stdout.
This is a brain dead take by people. Python can call C libraries or Rust libraries anytime. It more easily integrates with custom kernals (CUDA). OP is the slow one IMO.
Do hard compute tasks using the right libraries, or use your own well written libraries and you can get all the performance you want in python. It's also 10x more readable.
Oh, and the compiler writes all the real code anyway...
I'm going to push back on this and say that high-performance Python is totally possible. There's Cython which is super fast and if it's numerical code, you can use numba.
And obviously Python has very good C-interop. Rust has interop too, but it doesn't place nicely with the the borrow checker.
I have written pure python libraries that use numba for JIT compilation that have been performance comparable to C++ and Rust libraries for the same task. It is certainly quite possible. Sure one might be able to wring out a little extra performance with a compiled language, but not very much, and likely with quite a lot of effort.
Python strong sides are being easy to read and easy to write. And a lot if wonderful libraries, making it even easier. Unfortunately, it no longer matters, since all the writing is made by ai. It is no longer my language of choice for web api :(
An actual funny programming related joke in the sub. All the butthurt pythonistas crawling out of the woodwork saying more things we can laugh at is a bonus.
Python is not that slow as you can think. However it will use a shitload of ram and cpu. And if you want to deploy it on a tiny device it will require a huge runtime instalation
849
u/ProgramBrave718 2d ago
Python after saying it's name to Rust - "I am known for machine learning. But, devlopers call me slow"
374
u/Cxvvtgupvvdi 2d ago •
from shitWrittenInC Import callHyperoptimizedMethod
783
u/YamroZ 2d ago edited 2d ago
The Python script was ready week ago, took 5 minutes. Rust programmer first took 3 days to tell EVERYONE how much better it will be in Rust, then started coding and got bogged down for 2 days in a forum discussion on how to best secure memory for a "hello world!" string.
3.3k
u/Memorius 2d ago
Comparing a language that gets compiled into native machine code to a language that typically compiles to and interprets byte code at runtime. Is there a point to this meme?
205
u/Percolator2020 2d ago
This wasn’t even funny when it was an IE joke.
159
u/IAmASquidInSpace 2d ago •
Haha, Python slow, comedy genius! Never heard that before! So original! Haha!
60
u/deanominecraft 2d ago
more accurately python would spend 2 panels asking its friend C to answer the question for it.
12
u/cicciograna 2d ago
I remember when the butt of this joke was Internet Explorer.
29
u/irishcoughy 2d ago
ITT people who write code for a living or as a hobby seemingly unable to grasp that programming languages have use-cases and are rarely if ever universally applicable.
28
u/MiloBem 2d ago
Python is slow but that's not a problem for a scripting language which is used for data pipelines, prototyping, and teaching coding basics to high schoolers. No one sane is using it where performance matters, like microservices. Oh, wait.
18
u/HikariAnti 2d ago
This meme is actually pretty accurate because Rust programmers will tell you that they are Rust programmers without you ever asking.
17
u/SeaTurtle1122 1d ago
If the speed of Python is, in any situation, your bottleneck, you’re doing something stupid. The large majority of all modern code is IO bound, not compute bound, and if you’re doing compute intensive work, pandas, scipi, tensorflow, google OR tools, and a number of other libraries exist to do it properly, and if none of those work, writing C code with a wrapper for Python isn’t hard. There’s boilerplate and considerations, but there are lots of tutorials and it isn’t mechanically difficult to do.
Python has issues, but if you’re complaining about Python and aren’t focused primarily on the awful state of Python package management, you don’t know enough about Python to make jokes about it.
16
u/Educational-System48 2d ago
I've never had a problem where the bottleneck was Python being slow.
21
u/JockstrapCummies 2d ago
If you factor in the cargo build time of compiling 200 crates down the dependency chain, Rust will probably start speaking only after Python has said hello and goodbye.
10
u/Soumalyaplayz 1d ago
Ah yes. A compiled language which takes ages to compile vs an interpreted language which takes ages to interpret.
This war was promised to us 3000 years ago
5
u/Lowmax2 2d ago
Python can be lightning fast when you use the right libraries. Obviously it's written in c++ or something on the back end, but it's still python being written by the end user.
25
u/JAXxXTheRipper 2d ago
If you don't have a time-sensitive project, this doesn't matter in the slightest. Speed is rarely the deciding factor.
I'd rather work on a python project than on rust tbh. Rusts syntax is just ew
20
u/RhuanPacheco 2d ago
Why are you crying so much over Python memes? When a JS meme gets posted for the millionth time, there isn't nearly as much complaining...
4
u/urbaum 1d ago
Show me you know nothing about programming
26
u/R15H1_3 2d ago
Bro hadn't even finished importing the libraries yet.
12
u/lostUd_ 2d ago
as someone who finds programming to be incredibly boring and will avoid computer science by all means necessary, I find this sub pretty funny
6
u/Trang0ul 2d ago
- Knock, knock!
- Who's there?
- ...
- ...
- Python!
- Knock, knock!
- Who's there?
- C++ !
- Knock, knock! Assembly!
3
u/Unlucky-Durian-2336 2d ago
I still remember "knock knock" Java joke from years ago.
3
u/Liliths_Ace_Friend 1d ago
My brain runs on python
3
u/admiralsj 1d ago
Yes Rust is more performant, but... many high volume production sites run with python back ends.
Both will do the job in probably 99% of use cases. Yes Rust is faster but Python has a more mature ecosystem and is easier for noobs
10
u/steadyfan 2d ago
Comparing the speed of a dynamic interpreted language to a static one that compiled machine code.. Let's next make a joke about how much faster a car is that a horse.
16
u/Dhruv_Malaviya 2d ago
Python was still importing the conversation
5
u/RedAndBlack1832 2d ago
Me when scripting language used for scripting and rapid development:
it doesn't need to be fast, and when you want something done fast, you call into a C/C++ library
4
u/TactfulOG 2d ago
r/programmerhumor try not to compare different use case languages for 1 fucking day impossible edition
6
u/tigrankh08 2d ago
piton bad 😡
peak r/ProgrammerHumor
2
u/RED1869 2d ago
Python still being there when Rust is long gone
2
u/heckingcomputernerd 2d ago
If you account for compilation time, you can swap rust and python in this meme lmfao
2
u/Buyer_North 2d ago
same as C++ with Rust
2
u/Andrei95 22h ago
Mehh, this really depends on what you are doing. I took a monster spreadsheet that we use for design calcs. Essentially, it's a bunch of linear algebra and some optimization routines; it took 10+ seconds to update the sheet every time you changed a single input. I moved it over to Python with a mix of numpy and scipy, nothing fancy, just basic stuff, that got it down to under a second (~100s ms). Then I went to pure functions with Numba njit, which got me down to the 10s of microseconds range. I doubt going from njit to something like Rust or C would be any faster. Maybe for non math dominated tasks it might be different, but for me numpy/scipi or numba is as fast as possible, without having to spend crazy amounts of time on it.
2
u/1_89 22h ago
Counterpoint: python bindings for non-programmers
3
u/Sirico 2d ago
We need this tool by Friday...
3
u/liggamadig 2d ago
Well, the computer's time is cheaper than mine so I'll continue using Python.
3
u/SrWloczykij 2d ago
The world was a much better place when Rust bros were still hiding in their cellars.
4
u/StarLan7 2d ago
Is this still funny?
3
u/not_perfect_yet 2d ago
This is inaccurate, Rust should be unreadable. ;)
3
u/Koltaia30 2d ago
Reality: Reverse roles. Python goes: "How rude". Rust: "Compilation failed: you tried to store a returned reference or something"
2
u/zyxzevn 2d ago
It is the reverse. Rust will still be compiling....
2
u/alliewya 2d ago
Claude, rewrite this meme in rust, make no mistakes
2
u/danfay222 2d ago
Python is only really slow if you have no idea how to use it. Sure it’s never going to beat compiled lower level languages like rust or cpp, but if you use and build proper libraries for your application in python it’s often a lot closer in performance than most people think
2
u/HaDeS_Monsta 2d ago edited 2d ago
I one wrote a Rust project which called a Python server and I had a variable called PYTHON_SKILL_ISSUE_DELAY, because otherwise python could just not keep up
1
u/Anthonyg5005 2d ago
I haven't seen this image in years
1
u/Fancyness 2d ago
made me chuckle
1
u/SenorX000 2d ago
1
u/Relevant_Research_98 2d ago
Shall we conveniently forget that rust gets compiled for eternity? Also make rust icon bigger.
I've made tools that prevents running `rm /tmp` etc and runs $0.unsafe if args are not sus, it takes ~10 times more space than core-utils' rm.
And it's lucky day if you try to make something with bevy and endup without wasting many gigabytes.
1
u/knowits 2d ago
fixing legacy python scripts is hell because you spend more time waiting for pip install than actually coding. meanwhile rust devs brag about their borrow checker saving them from segfaults while i stare at a yaml indentation error for three hours. shit world we live in where runtime errors are preferred over compile-time anxiety. i just want my code to run fast enough to close my laptop before battery dies
1
u/Understanding-Fair 2d ago
I've met both these people IRL
1
u/jakechance 2d ago
Something was said, not good! https://youtu.be/MzkWyhzwO1Q
1
u/payb4k 1d ago
1
u/BoobooSmash31337 1d ago
I would be shocked if PyPi doesn't have a print string intrinsic. Also would assume the string copy dwarf the function call overhead. So they'd do similar work in practice. I assume Python immediately drops to a more native layer to print to stdout.
1
u/DJcrafter5606 1d ago
I have to say the title could be a little bit more original 😅😅😅
1
u/GhostVlvin 1d ago
Rust compiles for ages while python runs for ages
Btw this is rebranding of same meme but with c++ instead of rust
1
u/KevinJRussell 1d ago
They coulda done this with Javascript instead of Rust and gotten the same results
1
u/AngusAlThor 2d ago
Ridiculous... Python would take several hundred panels to respond.
1
u/ouijiboard 2d ago
The Ol' internet explorer meme. How you've changed.
1
u/Krustenbaecker 2d ago
I read with 1Hz temperature sensors and store them. No reason to do this faster.
1
u/Successful_Noise_347 2d ago
Python is not slow. It is just waiting for the C library underneath to finish.
1
u/Dry-Refuse-8132 2d ago edited 2d ago
This is a brain dead take by people. Python can call C libraries or Rust libraries anytime. It more easily integrates with custom kernals (CUDA). OP is the slow one IMO.
Do hard compute tasks using the right libraries, or use your own well written libraries and you can get all the performance you want in python. It's also 10x more readable.
Oh, and the compiler writes all the real code anyway...
1
u/Alternative_Act_6548 2d ago
not a rust fan, but that is funny
1
u/kiochikaeke 2d ago
It's been 0 hours since the last "python is slow/python is just calling C"!
The record is 0 hours!
1
u/SLOOT_APOCALYPSE 2d ago
..............J A V A has........... (Minutes go by) Updated..... Successfully
1
u/throwawayaccountau 2d ago
Now do it with Chinese Python.
0
u/bw_mutley 2d ago
It is 2026, GTA 6 just launched, and we are still arguing for PL war.
0
u/Own_Recommendation49 2d ago
The amount of salty people who are python shills is hilarious
0
u/hraath 2d ago
Not shown: rust showing up and python staring at it wonders what it's doing for an hour type checking and compiling
-1
u/pstwndnd 2d ago
Python is the Internet Explorer of programming languages.
-1
u/an_alex_at_a_time 2d ago
Every conversation with women that I've matched online aka bots went the same way lol
-1
u/slaymaker1907 2d ago
I'm going to push back on this and say that high-performance Python is totally possible. There's Cython which is super fast and if it's numerical code, you can use numba.
And obviously Python has very good C-interop. Rust has interop too, but it doesn't place nicely with the the borrow checker.
0
u/korneev123123 2d ago
Python strong sides are being easy to read and easy to write. And a lot if wonderful libraries, making it even easier. Unfortunately, it no longer matters, since all the writing is made by ai. It is no longer my language of choice for web api :(
0
u/ratbastid 2d ago
It's like my joke about Java.
Knock knock.
Who's there? . .
.
.
.
.
Java.
0
u/turtle_dragonfly 2d ago
Reminds me of an older joke:
Knock knock
Who's there?
(long pause) ...... ....... ..... ...... Java!
⠀
⠀
(VM startup time is a pain)
0
u/Ok_Actuary8 2d ago
FUCK YOU TONY!
0
u/average__Egg 1d ago
LMFAO
-26
u/budgiebirdman 2d ago
An actual funny programming related joke in the sub. All the butthurt pythonistas crawling out of the woodwork saying more things we can laugh at is a bonus.
-1
u/Sea-Fishing4699 2d ago
Python programmers are way more abundant and cheaper
-1
u/Creepy_Jeweler_1351 2d ago
Python is not that slow as you can think. However it will use a shitload of ram and cpu. And if you want to deploy it on a tiny device it will require a huge runtime instalation
-3
u/DT-Sodium 2d ago
Python is so dumb it would probably have misspelled its name.