Python vs C++ performance comparison

I had written a simple program in Python to find number of relative prime numbers between 1 to one million, hovewer I was turned off by slow speed of the program – which was estimated on about 80 hours.

So I had rewritten the program in C++. Here you can see pretty much the same program in C++ (arguably even better, as no arrays are created), but C++ is still a bit slower to Python.

The result surprised me.

, , ,

Leave a Reply

Your email address will not be published. Required fields are marked *