by kunley · 16y ago · 0 comments
When I say many/most software written in Java is slow, people tend to laugh and direct me to the shootout benchmarks. This is actually sign of ignorance of what's really going on in the wild, which you can learn at operations btw. You don't put your stack of dependency injection, loggers and ORMs into a microbenchmark like shootout, while you do it for the typical Java web application. The insane amount of calls on stack - tens of thousands and above, and the insane amount of small classes which all have to be managed by classloader, takes your app out of cpu cache, takes your files out of os file cache, pumps the enormous memory usage, stresses the gc and causes your JVM to have its crawling moments - or crawling standards.
So it's not that JVM itself sucks, but the stuff you typically want to run on it makes it a horror.
http://ptrthomas.wordpress.com/2006/06/06/java-call-stack-fr...
I think it's worth considering that there's no such thing as "microsecond spent on few commands" alone. Every extra vm command competes with others in the cpu cache, similar for classes loaded in the os file cache. It seems to matter when you have thousands of typical calls on a stack instead of, say, dozens.