I'm sure it is generally, but with this example of a for loop and printing a number each time within that loop, it doesn't seem to be the case, which surprised me.
I'm sure it is generally, but with this example of a for loop and printing a number each time within that loop, it doesn't seem to be the case, which surprised me.
I don't suggest this is a flawless benchmark, it's no more than idle amusement ...
Note that the Python version only runs 1/10 of the iterations, so you could extrapolate that to ~365s. It can be compiled of course, if anyone wants to try that (or to eliminate the sqrt). Source code attached -- you'll need Free Pascal installed to try the Pascal, or just remove it from the Makefile.Code:$ make benchmark time ./eratc C real 0m9.573s user 0m9.557s sys 0m0.008s time ./eratcxx C++ real 0m10.580s user 0m10.557s sys 0m0.012s time ./eratp Pascal real 0m11.969s user 0m11.941s sys 0m0.016s time java Erat Java real 0m11.220s user 0m11.245s sys 0m0.076s time ./eratpy.py Python (only 1/10 of the iterations) real 0m36.453s user 0m36.350s sys 0m0.056s
Comparison.tar.gz
Please create new threads for new questions.
Please wrap code in code tags using the '#' button or enter it in your post like this: [code]...[/code].
I think ofnuts meant that you really don't have far to look to find a language implementation that underperforms Java (for some applications), so saying it's the slowest thing you've ever used says more about the range of your experience than the limitations of Java itself. (It probably also says something about the kind of programs you write; Java performs better with straight mathematics than heavy text manipulation, for instance.)
Python and LabVIEW come to mind as fairly popular languages that I've used that may underperform in certain areas when compared to Java.
Last edited by trent.josephsen; March 9th, 2013 at 06:17 PM.
dear trent.josephsen it dosn`t matter what our frient meant : the java, the program i written in java or ...
java is slow, maybe not the slowest but it is slower than C - C++ - Python - even C#
- "Make me a coffee..."
- "No"
- "sudo make me a coffee"
- "OK"
Could you give us a timed example where Python runs faster than an equivalent Java program written with a modern JDK and JVM?
Please create new threads for new questions.
Please wrap code in code tags using the '#' button or enter it in your post like this: [code]...[/code].
I honestly would love to get some examples as well. I have written my fair share of number-crunchers and algorithm implementations in my time in all of Java, C and Python, and generally Java is almost always performant enough not to justify implementation in C because of Java's speed of development, while Python likewise tends to choke very quickly indeed...
LambdaGrok. | #ubuntu-programming on FreeNode
Bookmarks