Why is Python slower than Java but faster than PHP
Posted
by
good_computer
on Programmers
See other posts from Programmers
or by good_computer
Published on 2012-05-03T13:45:26Z
Indexed on
2012/11/16
5:13 UTC
Read the original article
Hit count: 472
I have many times seen various benchmarks that show how a bunch of languages perform on a given task.
Always these benchmarks reveal that Python is slower then Java and faster than PHP. And I wonder why is that the case.
- Java, Python, and PHP run inside a virtual machine
- All three languages convert their programs into their custom byte codes that run on top of OS -- so none is running natively
- Both Java and Python can be "complied" (
.pyc
for Python) but the__main__
module for Python is not compiled
Python and PHP are dynamically typed and Java statically -- is this the reason Java is faster, and if so, please explain how that affects speed.
And, even if the dynamic-vs-static argument is correct, this does not explain why PHP is slower than Python -- because both are dynamic languages.
© Programmers or respective owner