What makes python slower compared to languages that are compiled ?☺☺ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What makes python slower compared to languages that are compiled ?☺☺

I know what compilation does..buh not much for interpretation as it's used in python

27th Jan 2020, 9:29 PM
Wint3r
Wint3r - avatar
4 Answers
+ 5
Python’s slowness is partly due to the fact that it is a dynamically typed language. Unlike statically typed languages like java, most of the work of a dynamically typed language is done at run time. Dynamic datatypes and methods look up can be very expensive and time consuming. This can make the language relatively slow compared to compiled and statically typed languages like java, c, c++ for which most of the work is done at compile time.
27th Jan 2020, 10:47 PM
philip appiah
philip appiah - avatar
+ 3
With interpreted languages, every instruction needs some additional work of being translated from the human readable form to the machine readable form. This takes extra time making the process slower than in the case of a compiled language.
29th Jan 2020, 3:11 AM
Sonic
Sonic - avatar
+ 2
Seb TheS Java is compiled to bytecode that is platform-independent and therefore portable. This is one of the key "selling points" of the language. But this bytecode is then interpreted by the platform-specific JVM, and this takes some performance overhead, compared to languages that compile directly into native code. However this difference has really diminished a lot since early versions of java, because JVM technology improves all the time, with various performance optimizations, and JIT (just-in-time) and AOT (ahead-of-time) compilation.
28th Jan 2020, 6:50 AM
Tibor Santa
Tibor Santa - avatar
+ 1
philip appiah Someone told Java would also be slow, is this true? Why would Java be slow?
28th Jan 2020, 6:30 AM
Seb TheS
Seb TheS - avatar