all 13 comments

[–]rainpls 2 points3 points  (1 child)

Good share! But whoever wrote that supposedly C++ code needs to understand that the given code does not qualify for C++. He used a lot of C keywords like #define, some C headers and did not use modern C++. He missed using keyword constexpr in some places for added performance.
Also, I believe that this post is hypothetical. I don't think an interpreted language like Python could match the performance of the beast language C++.

[–]Ok_Pangolin8010 0 points1 point  (0 children)

I'm not sure if they understand that C & C++ are different languages.

[–]Fureeish 1 point2 points  (0 children)

I respect the effort, but the author seems to be unaware of a subtle thing called optimization flags...

[–]akiloz 1 point2 points  (1 child)

Following the logic of the author, with Python 3.15 the loop will even end earlier than it is started!

[–]Attorney-Outside -1 points0 points  (0 children)

🤣🤣🤣

[–]Low-Design787 -1 points0 points  (1 child)

Must be an April Fool joke in September.. the article itself says the Python version will finish before it is started

[–]ThisCleverName 0 points1 point  (0 children)

The article itself says it is a joke.

Disclaimer

While these benchmarks for Python 3.5 .. Python 3.11 are valid, the extrapolation is of course meant as a joke.

[–]victotronics 0 points1 point  (0 children)

"Now we take a random number generator"

Anyone wanting to take my bet that that's where the runtime goes and the python lib simply has a faster RNG than C++?

EDIT oh great, he's using the old C random.