Java Will Remain Slower

 

So why is it that not even hardware acceleration can make Java run as fast
as native code? Some reasons are listed on this slide.
First we have things like array bounds checking, dynamic type checking,
garbage collection. These are built-in features of Java that you can't avoid
Then we have expensive native calls. I should mention that you can't even
have native code in your own app, but the built-in libraries often need to call
native functions.
One important thing is that you get no access to SIMD instructions and other
special CPU features. When you're woring in native code, you can get a big
performance boost by writing some of your critical routines in assembly and
using the ARM equivalents of Intel's MMX and SSE
Then finally, there's the poblem Java bytecode has a stack-based execution
model, whereas all CPUs are using registers. It's hard for the VM to compile
stack-based code into fast register-based code, and that's probably one of
the reasons why the HotSpot VM performs so badly. But there are other
reasons, too.
So the bottom line is that Java will remain slower than native code, and we
just have to live with that fact. The performance gap will become smaller, but
it will not go away.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值