Josh Weinstein
Sep 21, 2022

--

So this actually isn't a benchmark of Python vs C++, it's a bench mark of two C programs.

What a lot of people don't understand is Python code can be written in such a way that it has a very low overhead over C level code. The Python code here is just doing some arithmetic and a for loop. All of this is just a few byte code instructions over the C layer.

Now, A true Python program with many classes, and functions won't ever be as fast as C++ because thte layering in Python's virtual machine become far greater and the slow memory allocation mechanisms in Python come much more into play.

--

--

Josh Weinstein
Josh Weinstein

Written by Josh Weinstein

I’m an engineer on a mission to write the fastest software in the world.

No responses yet