5 ms·
> relatively good performance, That's kind of downplaying it right? Outside of "native" languages like C, C++, Rust, fortran, Java blows everything else out of
by azth 5y ago
> relatively good performance,
That's kind of downplaying it right? Outside of "native" languages like C, C++, Rust, fortran, Java blows everything else out of the water.
- kevincox 5y ago"If you exclude the well performing languages java performs excellently." But that is what I think OP means. It isn't top tier performance, but it is in the second tier which I wouldn't argue for qualifying for "relatively good". FWIW I find that languages tend to fall into a couple rough performance groups: - Native at about x1 performance: C, C++, Rust, Fortran - Compiled GC at about 2x performance: Java, Go, Haskell, Lisp - Dynamic at 20-50x native performance: Python, Ruby... JS is a weird one that varies a lot depending on your workload and can sometimes look similar to compiled GC performance.
- igouy 5y agoMaybe there's a chart… https://benchmarksgame-team.pages.debian.net/benchmarksgame/box-plot-summary-charts.html#chart-fastest https://benchmarksgame-team.pages.debian.net/benchmarksgame/...
- jollybean 5y agoJavascript in V8 is more performant than Java on a lot of tasks, and almost always 'sooner'. V8 is focused on 'getting going quickly' and it does, very fast. Java takes some time to optimize for most tasks. Also, 'performance' isn't really an issue once you are past 'good enough'. I don't think most devs are worried about Java/Node/Python/Golang performance on the backend for most apps. Obviously not always the case, but in most instances, it's not a primary concern. Frankly, these days, when I think about 'performance' I think about 'developer performance!'. Java downsides in that its bureaucratic by convention, but at least it's super solid and reliable. I really, really wish it were a bight lighter however.
- azth 5y ago> Javascript in V8 is more performant than Java on a lot of tasks, Source? I constantly see companies switching from the likes of python and javascript to compiled languages after they reach a certain scale. I find Java to be extremely developer friendly, especially nowadays with features like pattern matching, records, switch expressions, and the upcoming project Loom Modern frameworks like quarkus.io are also a step in that direction. You might also want to check out https://jodd.org/ https://jodd.org/.
- kaba0 5y agoJavascript is much closer to java than to python in terms of performance. And due to the variability of the JIT compilers, it can sometimes be faster than java, but generally the latter wins out. But the parent poster is right that the two teams did choose a different workload to optimize for, V8 being fast faster while java taking more time to JIT compile a region, but that is mostly due to the difference between their most-common uses, running websites’ code as soon as they load vs mostly running on huge—ass servers with sometimes terabytes of RAM.
- jollybean 5y agoSource? Reality! :) I've built V8 instances and run some tests, but you don't need to do that. Just write some roughly equivalent code and run it in Chrome vs. JVM and see for yourself. It's not nuance or controversial, it will really 'stick out'. In basically all cases, V8 will 'get fast very quickly', it reaches a high level of performance on the second or 3rd iteration of a bit of code, whereas Java takes thousands of iterations. That's a very, very broad and crude generalisation, but you'll see it very clearly if you just try it yourself. It actually does make a difference depending on what you are doing as well - if you're running as server that uses the same code paths all day long, and executes them 1K times per minute, well then Java is fine. But for things like UI I particular where yo need the code to react it's a problem. 'Developer friendly' and 'modern frameworks' are a another question.
- pulse7 5y agoJava is typed, JavaScript is not typed. You can make more performance optimizations if you know types. So this claim is unlikely to hold...
- paulmd 5y ago(parent here) Yeah, I'd agree (with the sibling as well). Obviously native code is faster but Java is about as fast as it gets for a managed language. It's massively fast (these days) in comparison to, say, Ruby. Python manages to do relatively OK by throwing away any sense of threading and the synchronization of internals that might entail but it's still significantly slower than Java. Speaking of which that's another advantage of Java. Threading works basically as expected, and now it's even got modern promise/future APIs. Python's "just clone all your memory and do everything through IPC" is super clunky in comparison. In many cases, that's also inherited by other JVM languages, and interop is really cool there too. You can use Java libraries in your Scala/Kotlin/etc, or call those routines from your Java code. It's not just one language, it's all the languages on one engine, and they all run decently fast for what they are. C#/DotNet is really fast too (I would say faster than Java if anything) and it's pretty similar to Java in most ways. Bytecode, JITed, static typing, etc. They also got the second-mover advantage, to see all the things Java did wrong and fix them - like checked exceptions, or the clone() interface. On the other hand, at least as of 10 years or so ago, the tooling was absolutely primitive compared to what's out there for JVM stuff (and at the time it was all tied to Windows). Maybe that's changed with Roslyn but they're coming from behind, and Java has been around for a long time and it's tough to overcome that inertia.
- azth 5y agoC#/.NET are cool. Ironically enough, Java is getting the second-mover advantage when it comes to green threads by means of Project Loom. Forgoing async/await for a much better experience.