Compared to new programming languages like Go, Python is a relatively slow high-level programming language that makes the execution of its programs take more time. At the end of this article, you should have understood why it is, how you can speed things up, and what the core creators of the language are doing to improve the runtime speed.

_This article was originally published on The Chief I/O: _How Python Is Becoming Faster?

Even though Python is a dynamic, easy-to-learn language with simple syntax, it is relatively slow when compared to languages like Java, Go, C and C++.

comparison of popular frameworks built with Python (Django) and languages like Go (Gin) shows that the Go framework runs more requests per second (114 963) than Django (8 945); this shows that Go is about 12 times faster than Python.

The fundamental reason behind this slow execution of Python code is because it is a dynamically written language.

Java, for example, is a statically typed language that runs all necessary checks and compiles the code before runtime; this optimizes the program and makes it run faster.

On the other hand, Python is a language that is compiled at run time because, as a dynamically written language, any variable type or value can change while the program is running. For this reason, Python code cannot be compiled beforehand, and because of that, the code cannot be optimized at runtime as we have in low-level languages like Java or C

Another reason behind the slow execution of Python compared to languages like Java or C is because Python is an interpreted language — while Java is a machine language.

An interpreted language like Python needs to be converted to a machine language before its execution; this compilation process also explains another reason python is slow.

Even if Python is slower, it has a simple syntax and a large number of libraries and contributors. This can partly explain why it is being used in many common and less common fields like GPU-dedicated tasks like machine learning and artificial intelligence.

So, is there no way to make Python faster?

#python #programming-languages #programming #software-development #flask

How Python Is Becoming Faster?
1.60 GEEK