(no title)
shartacct | 4 years ago
There haven't been any notable language features added since java 9 besides some basic syntax sugar (which is already covered by stuff like lombok anyway).
For features and performance you might as well just target .NET 6. It has things that have been perpetually 'too hard to implement' (read: oracle doesn't want to pay their engineers to impl it and will sue you if you do it yourself) like value types, generics without type erasure, no checked exceptions, etc. and with .NET 6 performance is better than OpenJDK across the board.
amarshall|4 years ago
shartacct|4 years ago
KronisLV|4 years ago
Regardless, i actually compared Java with .NET and their web frameworks as a part of my bachelors', everything from synthetic benchmarks for encryption and data processing and transformations, to things like shuffling JSON around. Now, it's all in Latvian and was a number of years ago, so it's not entirely relevant at this point, but i did have some tangible findings.
In short:
Since then: If you care about benchmarks and vaguely realistic performance comparisons in the current year, simply have a look at the TechEmpower benchmarks: https://www.techempower.com/benchmarks/#section=data-r20&hw=...If you jump around the different tabs that compare which frameworks do what better, on average:
These are probably better than me linking the bachelors' because it's done in a better controlled environment, with more resources, and a lot of people contributing to the source code of the benchmarks: https://github.com/TechEmpower/FrameworkBenchmarks/tree/mast...In short, you're not necessarily wrong - there have indeed been great improvements to the .NET platform and it's good to see it finally being a capable and performant tech stack that you can use on *nix. But you're also not right: Java is getting similar attention, even though it's still lagging behind a few years in regards to "having its stuff together" (e.g. going from Oracle JDK to a more stable model + the JDK 8 to newer version shift, which is similarly painful with old .NET versions).
To lighten the mood, i'd consider suggesting that anyone also have a look at Go, which is similarly performant and allows you to build runtime independent executables by default, which is easier than in either .NET or Java. It's also pretty easy to write and has seen good use for the development of tools, since its startup time is a tad better than either that of Java or .NET as well. Here's the three compared: https://www.techempower.com/benchmarks/#section=data-r20&hw=...
kaba0|4 years ago
Also, Oracle does pay plenty for the development of Java, and is a (surprisingly) good steward of the language, let’s drop all the blind hate.
And both in terms of GC and JIT, the JVM ecosystem is ahead, the reason they can be so head-to-head is that the CLR doesn’t hide lower level controls all that much, allowing for better hand-tuned programs (at the price of the resulting code not getting “automatically” faster in a possible future release)
vips7L|4 years ago
All of this is currently being implemented in project Valhalla...
throw868788|4 years ago
It's comparing apples to oranges - in this case .NET is also being actively worked on so may have other things by then. Compare current state only.
The truth is each platform has prioritized features relevant to its context. For what its worth in my experience while the JVM has many more JIT optimisations and the like it tends to need them more of them given the lack of some of those features you mention (e.g. value types). Whereas .NET code allows value types, better management of memory (i.e. Span), reified generics etc so the focus has been to allow the user to optimise themselves where required where still allowing for a decent performance default. Many of the optimisations in the JVM wouldn't have the same bang for buck in .NET and vice versa.
On a personal note I'm more of a fan of the .NET philosophy because the code is usually fast enough, and when I need to tune memory, avoid allocations, and do fast code it seems to offer more tools not in an unsafe context to do so. It allows a better "upper bound" of performance for core things IMO while keeping to bytecode/IL. Many benchmarks where the same level of application optimisation has occured from what I seen have confirmed this bias for me. YMMV
shartacct|4 years ago
krzyk|4 years ago
You could call `+` syntatic sugar, just like anything past assembler being that.
shartacct|4 years ago
None of those are features, they were desperately needed shorthands for common java idioms. This is like calling braceless if/for/while statements 'features', when they're purely syntax sugar that has fallen out of favor completely because there's been several major security vulns found in major projects due to their use and development oversight/code review failure (https://nakedsecurity.sophos.com/2014/02/24/anatomy-of-a-got...), to the point where most companies ban writing them.
Just off the top of my head:
* LINQ. Added to C# in 2007, Java didn't get streams until 2014.
* structs/value types, implemented in net framework and net core for 15+ years, but not present in java 17. Some oracle engineers have been working to implement them under project valhalla but it seems to be vaporware at this point after 8+ years of work.
* unsigned types, no plans to implement in java (though IIRC it was originally planned as part of valhalla)
* async/await
At the feature level Java is stuck in the mid 2000s. Nobody wants to do the actual work on keeping it competitive.
hawk_|4 years ago
shartacct|4 years ago
.NET 6 is vastly more performant than .NET 5, which was already faster than openjdk and openj9 (https://devblogs.microsoft.com/dotnet/performance-improvemen...)
> and also what do you mean by oracle suing if you implement value types?
this one shouldn't need an explanation, oracle very commonly pursues frivolous lawsuits as a way of bullying money out of businesses that don't have the budget to fight them for years in various courts.