Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Which is faster, Java or Python?
- CatsUnited
-
1000+ posts
Which is faster, Java or Python?
Java probably. Python is pretty slow as far as I heard.
- iamunknown2
-
1000+ posts
Which is faster, Java or Python?
It isn't about programming languages. It's about the Java probably. Python is pretty slow as far as I heard.interpreter/compiler.
It's like asking “Which is faster for reading? English or French?” it depends on the person and their education.
Last edited by iamunknown2 (June 26, 2015 13:24:47)
- CatsUnited
-
1000+ posts
Which is faster, Java or Python?
Java is quite a heavy platform then, so I'm not quite sure.It isn't about programming languages. It's about the Java probably. Python is pretty slow as far as I heard.interpreter/compiler.
It's like asking “Which is faster for reading? English or French?” it depends on the person and their education.
- Znapi
-
500+ posts
Which is faster, Java or Python?
Java should definitely run faster than Python. Java is compiled into binary .class files, and is run in a virtual machine. Python is interpreted from the source code you write, like Scratch does behind the scenes.
I'm confused as to what you mean. Are you saying it depends on their implementation of the Python interpreter or Java VM?It isn't about programming languages. It's about the Java probably. Python is pretty slow as far as I heard.interpreter/compiler.
It's like asking “Which is faster for reading? English or French?” it depends on the person and their education.
- Firedrake969
-
1000+ posts
Which is faster, Java or Python?
Sometimes Python is compiled (such as in .pyc files)
- bobbybee
-
1000+ posts
Which is faster, Java or Python?
Sometimes Python is compiled (such as in .pyc files)
.pyc isn't actually compiled — it's just turning the python plaintext into Python bytecode. Granted, this does give a speed boost, but it's not due to compilation – it's simply that there is no need to parse the source code anymore. In fact, CPython, one of the most popular Python implementations, doesn't have a way to interpret python directory. If you notice, pyc files are generated when you interpret Python code… because that's how the Python interpreter internally works!
- Firedrake969
-
1000+ posts
Which is faster, Java or Python?
So compilers optimize as well as compile?
- iamunknown2
-
1000+ posts
Which is faster, Java or Python?
Yep. Java should definitely run faster than Python. Java is compiled into binary .class files, and is run in a virtual machine. Python is interpreted from the source code you write, like Scratch does behind the scenes.I'm confused as to what you mean. Are you saying it depends on their implementation of the Python interpreter or Java VM?It isn't about programming languages. It's about the Java probably. Python is pretty slow as far as I heard.interpreter/compiler.
It's like asking “Which is faster for reading? English or French?” it depends on the person and their education.
- iamunknown2
-
1000+ posts
Which is faster, Java or Python?
Compilers are smart nowadays, as they convert your Java into machine code. So compilers optimize as well as compile?
- iamunknown2
-
1000+ posts
Which is faster, Java or Python?
The people who criticise Java with the “heavy” problem are C/C++ developers - C is quite fast, as most implementations of it require you to compile the program into machine code before running it. On the other hand, MOST Java compilers compiles on the go - it only compiles when it needs to! Java is quite a heavy platform then, so I'm not quite sure.
- blob8108
-
1000+ posts
Which is faster, Java or Python?
This StackOverflow question is informative. Java is JITed, so it can be a bit faster for some things. But if you want your Python code to run faster, you can just use PyPy, which is a JIT for Python.
In practice, the difference between Java and Python is not that massive: they're both a lot slower than C, for example. Pick which of the two you prefer based on the language, not speed.
In practice, the difference between Java and Python is not that massive: they're both a lot slower than C, for example. Pick which of the two you prefer based on the language, not speed.
- irvinborder
-
2 posts
Which is faster, Java or Python?
There is a general problem with this question in that it is too absolute. It does not really make sense to say “language X is faster than language Y”. A computer language itself isn't “fast” or “slow” because it is merely way of expressing an algorithm. The actual question should be something on the order of “why is the implementation X1 of language X faster than implementation Y1 of language Y for this particular problem domain?”
Some speed differences are certainly going to fall out of the language itself as certain languages are easier to implement certain domains than others. But much of what makes an implementation fast isn't the language. For instance, you can't really say "Python is slower than Java" without considering whether you are talking about CPython, IronPython or PyPy. This is particularly true for languages that use a VM as the speed is going to be directly impacted by the quality of the VM.
http://net-informations.com/python/default.htm
Some speed differences are certainly going to fall out of the language itself as certain languages are easier to implement certain domains than others. But much of what makes an implementation fast isn't the language. For instance, you can't really say "Python is slower than Java" without considering whether you are talking about CPython, IronPython or PyPy. This is particularly true for languages that use a VM as the speed is going to be directly impacted by the quality of the VM.
http://net-informations.com/python/default.htm
Last edited by irvinborder (Oct. 16, 2019 06:29:01)
- TheAspiringHacker
-
100+ posts
Which is faster, Java or Python?
This is a good answer, but this topic is from 2015. You shouldn't post on inactive topics (necropost). There is a general problem with this question in that it is too absolute. It does not really make sense to say “language X is faster than language Y”. A computer language itself isn't “fast” or “slow” because it is merely way of expressing an algorithm. The actual question should be something on the order of “why is the implementation X1 of language X faster than implementation Y1 of language Y for this particular problem domain?”
Some speed differences are certainly going to fall out of the language itself as certain languages are easier to implement certain domains than others. But much of what makes an implementation fast isn't the language. For instance, you can't really say "Python is slower than Java" without considering whether you are talking about CPython, IronPython or PyPy. This is particularly true for languages that use a VM as the speed is going to be directly impacted by the quality of the VM.
http://net-informations.com/python/default.htm
- Discussion Forums
- » Advanced Topics
-
» Which is faster, Java or Python?