Hacker News new | past | comments | ask | show | jobs | submit login

Poor start-up time, terrible application bloat, uninspiring language with poor concurrency support, massive RAM requirements, everything XML, complex tuning required, what a nightmare.

No wonder the world is running towards Python and serverless as fast as they can...

Then they discover that even though Python is quicker to develop with, it actually runs much slower and has poor threading support. Since async only gets you so far, you try multiprocessing. It turns out running all those Python worker processes actually takes up more memory and CPU than the equivalent Java app...

Also, most of the things you complain about are not Java: they are the fault of JEE (aka J2EE) and "app servers."

CPython is 100 times slower and has no multi threading support (CPython is single threaded). JVM code can outperform native C code. The JVM supports many advanced languages (Scala, Clojure, Kotlin) and it can even run Python code (Jython) faster than CPython. For concurrency it has this ultra powerful library https://akka.io (Up to 50 million msg/sec on a single machine. Small memory footprint; ~2.5 million actors per GB of heap.)

Jython seems to be much, much slower than CPython, actually: https://pybenchmarks.org/u64q/jython.php

The only benchmark where it's faster is the one involving threads, which makes sense. CPython definitely has multi-threading support, but it also has the Global Interpreter Lock preventing threads from actually executing bytecode at the same time. Jython doesn't. People have written patches that successfully remove that GIL, but those patches make single-threaded performance worse and thus haven't been accepted.

I consider that as basically no multithreading support. CPython multithreading is useless in comparison. Those benchmarks indicate that the Jython compiler is far from optimal. The equivalent code rewritten in Java would be an order of magnitude faster. https://julialang.org/benchmarks/ (note the single Python outlier there is the result of calling a C library for matrix calculation). Anyway, the JVM and CPython are fundamentally not comparable. One is interpreting, and the other is a JIT compiler. There are Python JIT compilers that would make a better comparison. However, as a language, Python is not optimal for large codebases. Comparing the languages only (not their implementation), Python is good for small scripting tasks, Java is better for very large scale projects.

All that might very well be true, but I was responding to your assertion that "The JVM ... can even run Python code (Jython) faster than CPython".

Somewhere I heard that was the case, but I didn't verify it. These benchmarks show Jython performing hundreds of times worse. spectral-norm: 0.12 secs for CPython and 4.96 secs for Jython. How can the JVM be 40 times slower than an interpreter? Maybe they didn't warm up the hotspot compiler (amateur mistake), or the Jython compiler is suboptimal. However I compared the code: This https://pybenchmarks.org/u64q/program.php?test=spectralnorm&... versus this https://pybenchmarks.org/u64q/program.php?test=spectralnorm&...

The py3 version is calling numpy which calls a highly optimized C library. So this benchmark suite is worthless. They failed to warm up the JVM hotspot compiler, and they are comparing interpreted Jython with a highly optimized C library called from Python3

The lack of a warmup phase is confirmed by the raw command line and output logs on various benchmarks. Amateurs. This is a highly misleading set of results on multiple levels.


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact