23 ms·
How much faster is Java 17?
- vlovich123 5y agoI'm curious how the Shenandoah GC stacks up here.
- darksaints 5y agoOptaplanner is very much not the type of workload that would benefit from Shenandoah, which is optimized for reduced pause times and low latency. Optaplanner's most useful solvers do lots of garbage collection, so throughput considerations dominate significantly over latency concerns. You'd use G1, ZGC, or Shenandoah for web apis or trading platforms, but not for a computation heavy solver that is expected to not produce useful results for minutes or hours.
- marsdepinski 5y agoGood clarification as I don't believe many JVM users realize that the various GCs have different use cases.
- ge0ffrey 5y agoAgreed - but I 'll run the benchmarks anyway for a new blog post. Measuring is knowing. OptaPlanner is best of with Parallel GC (high throughput), but most java processes (REST services etc) are much better off with G1GC (low latency) and its siblings (Shanandoah, Z GC).
- titaniumtown 5y agowoah, super interesting. you should test ZGC as well.
- bambam24 5y agoIn silicon valley Java Is abandoned, and seen as a legacy programming language like php
- flerchin 5y agoI would like to see some workloads, not just GC times.
- Someone 5y agoFTA: “Each run solves 11 planning problems with OptaPlanner, such as employee rostering, school timetabling and cloud optimization.” How is that “just GC times”?
- ge0ffrey 5y agoHere's the script I ran, FWIW: https://gist.github.com/ge0ffrey/34b8a0c2f7b04c2aca7478b0e97b1d60 https://gist.github.com/ge0ffrey/34b8a0c2f7b04c2aca7478b0e97...
- igouy 5y agoApparently it depends which GC is used, so: > "0.37% faster than Java 16 for ParallelGC" > "2.41% faster than Java 16 for G1GC (default)" But as you asked, toy benchmark programs! https://news.ycombinator.com/item?id=28530126 https://news.ycombinator.com/item?id=28530126
- netr0ute 5y agoOne common workload is Minecraft, which just happens to be completely incompatible if you have any mods to improve performance already.
- bladelessninja2 5y agoYeah, I would like to see them to, especially when I see something like this: > When we benchmarked JDK 15, we saw that Java 15 was 11.24% faster than Java 11. Now, the gain of Java 17 over Java 11 is less. Does that mean that Java 17 is slower than Java 15? > Well, no. Java 17 is faster than Java 15 too. Those previous benchmarks were run on a different codebase (OptaPlanner 7.44 instead of 8.10). Don’t compare apples and oranges. Author is defending their other article by discrediting their own methods - what those percent values even mean if they differ so much between different versions of the same benchmark? Shouldn't benchmarks be profiled for specific workload types to simulate real life examples? How could you possibly change the workload so much it affects result so significantly and not change the nature of your benchmark?
- jakozaur 5y agoIt looks like majority of this gains are related to memory management and garbage collector or am I missing something? JDK 8 -> JDK 11 gains were huge thanks to String optimisations (e.g. GC could dedup strings and store one char as byte in many cases).
- RNCTX 5y agoMy knee-jerk reply when click on the topic was "depends on how much memory it demands." Good to find that the assumption was correct, lol.
- lmilcin 5y agoAnything more than couple percent just due to improved memory management is phenomenal improvement.
- mumblemumble 5y agoI'm not super surprised? That seems to be where most improvement happens across a variety of languages nowadays. I recently listened to an interview with someone working on Intel's C++, and he indicated that, contrary to popular assumption, most of the speed boost you can get with it isn't from better instruction-level micro-optimization, it's from analyzing information flows and maximizing locality of reference. Perhaps this is an inevitable result of that ever growing processor-memory performance gap. Nowadays, the cost of having to take a walk of shame out to the RAM chips is so great compared to everything else that I would assume that minimizing the number of times you have to do that is by far the lowest-hanging fruit.
- pulse7 5y agoJava's value objects (inline classes) will "maximize locality of reference". [1] [1] https://openjdk.java.net/jeps/169 https://openjdk.java.net/jeps/169
- hn_go_brrrrr 5y agoOr at least partially mitigate one of Java's biggest performance weaknesses.
- noisy_boy 5y agoConsidering tons of folks are still on Java 8, I would have liked to also see comparison between that and Java 17. Based on the improvements shown from Java 11 to 17, one could expect even larger improvements from Java 8.
- pantalaimon 5y agoI'm surprised that it's now common for software to require a certain (old) Java version. Wasn't the whole "write once run anywhere" promise about backwards compatibility too?
- the8472 5y agoThat generally holds when you stick to public APIs. But there are many libraries that used reflection to access unstable internals. And that broke with modules.
- native_samples 5y agoNo, it was more than that. Java has broken a ton of backwards compatibility in recent years. They stopped shipping a lot of stuff (like JavaFX), JavaEE stuff was removed from the JDK and then re-namespaced, they changed the formatting of the version number, they removed Web Start, they moved some stuff out of Unsafe, they changed how you access class files inside the JDK and so on. The idea that the only thing that changed was access to internals isn't really the case, but a lot of these changes were "allowed" because Java cares about compatibility with its own spec rather than specific popular apps.
- josefx 5y ago> They stopped shipping a lot of stuff (like JavaFX), I thought they just split up the JDK into modules, making some libraries optional for a smaller footprint if you decided to ship your program with the JDK included. I am quite sure swing was also split of and all my toy programs still run despite that. > JavaEE stuff was removed from the JDK and then re-namespaced, JavaEE was never part of the standard JDK. Never used it, but you can probably still find the old java package somewhere. > they moved some stuff out of Unsafe out of sun.misc.Unsafe, an internal API of the Sun JDK that wasn't in the java namespace, wasn't documented and had nearly every IDE scream at you.
- gavinray 5y agoTaking this opportunity to promote the author of this article (Geoffrey de Smet) and the project he's been the lead of for some very long amount of time (Optaplanner): If you've never heard of constraints programming -- it's really interesting (personal opinion). It lets you programmatically state "rules" and "goals" of some system, and solvers will automatically attempt to find the best solution. Optaplanner is one of the most advanced of such engines that I'm aware of: Under the hood, OptaPlanner combines sophisticated Artificial Intelligence optimization algorithms (such as Tabu Search, Simulated Annealing, Late Acceptance and other metaheuristics) with very efficient score calculation and other state-of-the-art constraint solving techniques. But it's also really approachable since they re-wrote it in 2020 to accept regular code for rules, instead of the custom DSL language they used before (Drools). https://www.optaplanner.org/blog/2020/04/07/ConstraintStreams.html https://www.optaplanner.org/blog/2020/04/07/ConstraintStream... I got interested in this area some years ago, and reached out to Geoffrey personally. He took the time to reply to me and answer a few questions. Great person, he's brilliant and super passionate about the domain. If you have any sort of practical usecase for this (scheduling, vehicle routing, cost optimization, etc) and this sounds at all interesting, highly recommend giving it a shot! As an example of what you can do in a few lines with this, here's one from the docs: The following code snippet first groups all processes by the computer they run on, sums up all the power required by the processes on that computer using the ConstraintCollectors.sum(… ) collector, and finally penalizes every computer whose processes consume more power than is available. private Constraint requiredCpuPowerTotal(ConstraintFactory constraintFactory) { return constraintFactory.from(CloudProcess.class) .groupBy(CloudProcess::getComputer, sum(CloudProcess::getRequiredCpuPower)) .filter((computer, requiredCpuPower) -> requiredCpuPower > computer.getCpuPower()) .penalize("requiredCpuPowerTotal", HardSoftScore.ONE_HARD, (computer, requiredCpuPower) -> requiredCpuPower - computer.getCpuPower()); } --- As a bonus, it's natively integrated into Quarkus and the Quarkus ecosystem. Quarkus is the best thing since sliced bread if you're on the JVM and are writing API's. https://docs.optaplanner.org/latest/optaplanner-docs/html_single/index.html#quarkusJavaQuickStart https://docs.optaplanner.org/latest/optaplanner-docs/html_si...
- vips7L 5y ago
- deleted 5y ago[deleted]
- derkoe 5y agoOur Spring Boot showcase application https://github.com/porscheinformatik/angular-spring-heroes https://github.com/porscheinformatik/angular-spring-heroes starts ~ 10% faster on Java 17 compared to Java 11 (compiled with target 11).
- facorreia 5y agoDo you happen to have a comparison from Java 8 to 11?
- derkoe 5y agoJust tried it - there is no significant difference between Java 8 and 11! They both start around 6.5s (JVM running for 7.4s). Java 17 starts the app in approximately 5.9s (JVM running for 6.7s).
- ge0ffrey 5y agoWe did java 8 vs java 11 a few years ago: https://www.optaplanner.org/blog/2019/01/17/HowMuchFasterIsJava11.html https://www.optaplanner.org/blog/2019/01/17/HowMuchFasterIsJ... TLDR: using the same GC (*), it's 4% to 16% faster (depending on the GC). But be warned that if you don't set a GC, Java 8 uses Parallel GC (high throughput, so faster) by default and Java 11 uses G1 GC (low latency, so less hickups) by default.
- vips7L 5y agoI hope spring moves to compile time di like quarkus and ajave inject instead of scanning the classpath at runtime.
- _old_dude_ 5y agoYou mean Spring native [1], i think it's not ready yet. [1] https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/ https://docs.spring.io/spring-native/docs/current/reference/...
- 5y ago
- adamc 5y agoHow does Oracle licensing play into this? Are these improvements likely to show up in less encumbered Java versions?
- carimura 5y agoAlthough there are lots of contributors to OpenJDK (which is where Java SE is built), Oracle continues to show up and do a large part of the work. This work is then used to build many distributions, including Oracle's JDK's. So the answer is yes these improvements will show up in most distributions. But anybody who wants to use a JDK built by Oracle can choose between the Oracle OpenJDK build [1] with the GPLv2 w/ classpath exception license, and now have the option to use the OracleJDK free of charge in production with a one year overlap between LTS's [2]. [1] https://jdk.java.net/ https://jdk.java.net/ [2] https://blogs.oracle.com/java/post/free-java-license https://blogs.oracle.com/java/post/free-java-license
- anonymousiam 5y agoI still have Java 8 installed. I'm not willing to accept Oracle's new Java license.
- vips7L 5y agoOpenJdk builds are GPLv2 with class path exception. Oracle JDK builds are also now free: https://blogs.oracle.com/java/post/free-java-license https://blogs.oracle.com/java/post/free-java-license
- bullen 5y agoThx, this is great news, but why the back and forth, they thought anyone would pay for something that has been free for 27 years? Java does not belong to Oracle, it belongs to whom ever codes Java. I have still to find a company that understands open-source.
- kaba0 5y agoOracle finances 90+% of the development of the free and open source OpenJDK, and just made their own OracleJDK completely free. What is not free is support for a specific older version.
- shrdlu2 5y ago>Oracle will provide these free releases and updates starting with Oracle JDK 17 and continue for one full year after the next LTS release. Prior versions are not affected by this change. So, if that had applied to 11, it would lose updates from Oracle in 1 year from now. Whereas something like Corretto is currently committed to Java 11 updates until 2027 [0]. They seem to also be planning to increase frequency of LTS to every 2 years, so, basically assuming you upgrade to next LTS immediately (unlikely in any moderately complex app with deps) you have 3 years of free updates. No thanks. [0] https://aws.amazon.com/about-aws/whats-new/2020/08/amazon-corretto-8-11-support-extended/ https://aws.amazon.com/about-aws/whats-new/2020/08/amazon-co...
- 5y ago
- vbezhenar 5y agoI think that one of the improvements is the ability to release memory to OS from VM when it's not needed. Might help with microservices.
- CyanLite4 5y agoStill in the bottom half of most benchmarks. Still magnitudes slower than its market competitor (.NET)
- fareesh 5y agoIs it worth upgrading for any performance improvements for a typical Android/Flutter workflow? Any improvements in compile times, running the emulator, running Android Studio, etc. ? How about gradle? I really dislike gradle.
- emmanueloga_ 5y agoOn a tangent optaplanner looks really interesting. Does anybody know by any chance how it compares to OR tools [1]? 1: https://developers.google.com/optimization https://developers.google.com/optimization