ByteBuffer.allocate() vs. ByteBuffer.allocateDirect()

To `allocate()` or to `allocateDirect()`, that is the question. For some years now I've just stuck to the thought that since `DirectByteBuffer`s are a direct memory mapping at OS level, that it would perform quicker with get/put calls than `HeapByteBuffer`s. I never was really interested in finding out the exact details regarding the situation until now. I want to know which of the two types of `ByteBuffer`s are faster and on what conditions.
To give a specific answer, you need to say specificly what you are doing with them. If one was always faster than the other, why would there be two variants. Perhaps you can expand on why you are now "really interested in finding out the exact details" BTW: Have you read the code, esp for DirectByteBuffer?

以上就是ByteBuffer.allocate() vs. ByteBuffer.allocateDirect()的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准