6 ms·
I know this is not a perfect benchmark, but TechEmpower runs benchmarks with tons of different libraries and frameworks, here is the latest round, filtered by j
by capableweb 5y ago
I know this is not a perfect benchmark, but TechEmpower runs benchmarks with tons of different libraries and frameworks, here is the latest round, filtered by just Java and JavaScript technologies: https://www.techempower.com/benchmarks/#section=data-r18&hw=ph&test=fortune&l=zik0ov-sf https://www.techempower.com/benchmarks/#section=data-r18&hw=...
First JavaScript on that list ranks 21th.
If you check out the complete listing (all languages, https://www.techempower.com/benchmarks/#section=data-r18&hw=ph&test=fortune https://www.techempower.com/benchmarks/#section=data-r18&hw=...), then a Java program comes at 4th place, after two Rust programs and one C.
Conclusion, Java is not as slow as people think, and absolutely faster than anything involving JS.
- KronisLV 5y agoI had a discussion about benchmarks and how useful they are a few days ago: i remember mentioning TechEmpower in particular because of how close to typical real world usage of the libraries and ecosystems their benchmarks are! That said, Vert.X and some other of the frameworks aren't exactly idiomatic Java, because they're heavily focused on maximum performance - when i last checked them out, there were even async JDBC drivers in development, and while the performance was indeed stellar, it wasn't exactly production ready back then. Edit: well, the actual way it writes and reads isn't bad in of itself, but some might need some time to get adjusted to the concepts. Actually, i'd say that it reads a bit more like JS: https://vertx.io/docs/vertx-core/java/ https://vertx.io/docs/vertx-core/java/ Of course, things have probably improved, but perhaps it's also useful to compare some of the full platform implementations and perhaps the most popular of each language's frameworks. Maybe even with ORMs, to also see how those technologies fare in reality, since i've personally seen some of the most widely used enterprise frameworks become pretty slow due to all of the abstraction that's going on, which perhaps is a deserved criticism for Java. So for most of the "boring & stable" projects, it could look a bit like the following: https://www.techempower.com/benchmarks/#section=data-r18&hw=ph&test=fortune&l=zik0ov-sf&o=e&f=2l24g-5pfk-27xgcw-0-0-72f4-4g-4-27xgcg-0-0-0 https://www.techempower.com/benchmarks/#section=data-r18&hw=... - Java, Spring: the most popular enterprise framework in my experience - Java, Dropwizard: a pretty good alternative to Spring that takes a number of the industry standard frameworks/libraries and integrates them (Quarkus not featured because while the MicroProfile compatibility would be useful to test, they actually have no tests with ORMs for now) - JavaScript, Express: still the most popular framework for back end development with Node - JavaScript, Node: sometimes i've seen people write servers directly as well, which is surprisingly far easier in Node than it is in Java (servlets and the abstractions around them can be unpleasant to work with) (Koa not featured because while it's gaining popularity, they actually have no tests with ORMs for now) With those particular frameworks, the scene changes a bit and both of them are far more similar in their performance. I'm not sure what the takeaway here would be: whether it's that Wirth's law (https://en.wikipedia.org/wiki/Wirth%27s_law https://en.wikipedia.org/wiki/Wirth%27s_law) applies to libraries that try to cover all use cases, that Java just has some popular frameworks which underutilize its potential for performant code, or that you really should compare particular frameworks, paradigms and implementations, rather than just languages in general (since the overhead cannot be disregarded). Of course, these results also may not be representative of the stacks that other companies use or even those that are popular in other regions of the world, so i invite you all to check out those results for yourselves with the stacks that you're considering and maybe even browse the test source code: https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks https://github.com/TechEmpower/FrameworkBenchmarks/tree/mast...