Why Python is Popular Despite Being (Super) Slow
Python is one of the most widely used programming languages, and it has been around for more than 28 years now. One common question arises in mind of most people, especially beginners, and newbies, that why Python is popular in the mainstream despite being slow? or why programmers or developers don’t care about speed and performance limitations in Python? In this post, I will go through some main reasons for this.
Why is Python Slow in Terms of Speed?
Before diving into details of why Python is popular in the mainstream despite being slow, I will shortly explain how or why Python is slow in nature in terms of performance and speed as compared to other popular programming languages like C and C++.
- High-level programming language: With Python, the code looks very close to how humans think. For this purpose, it must abstract the details of the computer from you: memory management, pointers,… Hence, it is slower than “lower-level language” like C;
- Python is interpreted and not compiled: Sure, this statement is a gross simplification but it’s somehow correct. During the execution, Python code is interpreted at runtime instead of being compiled to native code at compile time;
- Python is a dynamically typed language: Unlike “statically-typed” languages like C, C++ or Java, you don’t have to declare the variable type like String, boolean or int. The less you do, the more your computer has to work. For each attribute access, tons of lookup is required. In addition, being very dynamic makes it incredibly hard to optimize Python;
- Global Interpreter Lock (GIL): This GIL basically prevents multi-threading by mandating the interpreter only execute a single thread within a single process (an instance of the Python interpreter) at a time.
Why is Python Still so Popular?
I would say that 9/10 times the slower performance of Python does not matter. Below I will discuss some major aspects and reasons.
Only registered users can post comments. Please,
login or signup.
Start blogging about your favorite technologies, reach more readers and earn rewards!
Join other developers and claim your FAUN account now!