4 ms·
JVM doesn't really have a notion of virtual versus non-virtual methods, it's a matter of which calling opcode you use (invokevirtual versus invokespecial). It'
by jcranmer 11y ago
JVM doesn't really have a notion of virtual versus non-virtual methods, it's a matter of which calling opcode you use (invokevirtual versus invokespecial).
It's also sort of missing the big difference... the JVM is generally superior in performance to the CLR, having a better JIT and better GC performance.
- bunderbunder 11y agoI'm not sure I'd consider performance a big difference. Their performance is generally very close, and if you're in a situation to care enough about performance to split hairs then you really shouldn't be using a managed platform in the first place. The _real_ big difference is that Java has an enormous open source ecosystem, whereas much of what .NET has is ports or clones of successful Java projects. That said, I think .NET's probably the better choice for a lot of line-of-business applications simply because the tooling allows for very rapid development of that sort of stuff, and not having easy access to Hadoop or Akka really isn't much of a handicap when you're mostly just banging out a mess of business rules.
- jcranmer 11y agoThe title implies that it's comparing the runtime engines, and the performance is absolutely a major selling point of any such comparison, even if the practical effect of any difference is negligible. Ultimately, the comparison claims to be between the CLR and the JVM while it's more like between C# and Java, given how it only covers fairly superficial features at the front-end level and not what can and can't be done in VM code, let alone how different VM architectures can have major impacts on code design, etc.
- bunderbunder 11y agoI think the reason for this particular list is that it's from the standpoint of a programming language implementation team, and one that's currently working on targeting a 2nd platform. Given that, it reads as a list of what the VM can do for you and what you'll need to do yourself in the compiler.
- shrewduser 11y agoperformance is still important and a big selling point of the JVM
- cokernel_hacker 11y agoDoesn't the CLR work the same with the call and callvirt opcodes?
- MichaelGG 11y agoWhich is funny/sad, as the CLR has more opportunity for perf. For instance, in its generics implementation and value types. Though the CLR has a lot more "outs", where you can use raw pointers and such. Even put " managed" objects on an unmanaged heap. Don't think this is possible in the JVM. So you can write more C-like code in .net then you can represent in the JVM.
- Alphasite_ 11y agoBut both speculative optimisation/specialisation and escape analysis can recover some of the benefits of those features, can they not? And I don't know if it is possible yet, but for Java 9 Graal is an extension onto of the JVM and can run unmanaged C code alongside normal code, so it should be possible.