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

Speeding up Python

Python is often the language of choice for beginners who want to get the feel of programming. I enjoy using it as it is reasonably easy to find errors and get a program to do what I want. However, programs running in C run faster, so it should be the language of choice. Is there an easy way to program in Python and when it works efficiently to compile it as in C to produce a faster result?

10th Nov 2019, 1:31 PM
Roger Nunn
Roger Nunn - avatar
1 Answer
+ 2
Sadly Python can't be compiled due to its language design. There are some tweaks to make Python a little bit faster but it will still be 10 to 500 times slower than C depending on the workload. Maybe Rust might be an interesting language for you. Rust tries to be as high-level as possible while still maintaining the speed of low-level languages like C. It's been the most loved programming language for years according to the stackoverflow dev survey and I think this says a lot about it. And I, too, think that Rust is one of best languages ever created for many reasons. The official website: https://www.rust-lang.org/ And here's a online course: https://doc.rust-lang.org/stable/book/
10th Nov 2019, 1:50 PM
Aaron Eberhardt
Aaron Eberhardt - avatar