C++ vs Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

C++ vs Python

If C++ is faster than Python with numbers, and everything in a computer is represented as numbers, is everything faster in C++ (assuming you write better code than the people who created python) ?

17th Jan 2020, 5:38 PM
Angelo Nulsen
Angelo Nulsen - avatar
1 Answer
+ 1
Yes, c++ is generally faster than Python. In almost everything c++ is faster. Obviously you could write algorithms poorly in any language and doing so in c++ could make it lose an unfair comparison with Python. There are unusual cases where Python could sort of beat c++ with generally good implementations in both too. If your Python implementation used CUDA as in PyCUDA, your Python code would be taking advantage of graphics cards and GPU's. If you compared the performance of PyCUDA code with a CPU-based version implemented with c++, your PyCUDA calculations would perform multiples faster.
18th Jan 2020, 7:51 AM
Josh Greig
Josh Greig - avatar