TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Java Buffer types versus native arrays: which is faster?

10 pointsby tgymnichover 4 years ago

2 comments

jarielover 4 years ago
As with everything, it depends.<p>Buffers I believe were created for doing IO operations, wherein you need to move chunks of things around, wherein the underlying net stack needs to fill, flip, copy etc..<p>If you&#x27;re building a video compression library with native components, then Buffers are probably going to help.<p>If you&#x27;re living purely in Javaland memory managed space, then it&#x27;s entirely another question, but know that in the vast majority of cases it won&#x27;t matter.
pestatijeover 4 years ago
Try to do a flip and see what happens. Or copy your array to a file, or to a native library. I&#x27;ve never thought of buffers as a replacement for arrays, and I don&#x27;t think they were ever ment to be. The take away from the comparison is basically to do what we were doing already: use native arrays unless doing so with buffers simplifies your code.