Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7507695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:32:27+00:00 2026-05-29T22:32:27+00:00

Java is Big-Endian; Network stack is Big-Endian; Intel/AMD (basically all of our computers) and

  • 0

Java is Big-Endian; Network stack is Big-Endian; Intel/AMD (basically all of our computers) and ARM CPU’s (most common Android and iOS chips) are all little-endian as well.

Given all of that, if I am allocating a direct ByteBuffer for different uses, is it a good idea to always try and match the endian-ness of the native interaction?

More specifically:

  • Network Buffer: Leave it Big-Endian.
  • File Buffer (on x86): Little-Endian.
  • OpenGL/Native Process Buffer: Little-Endian.

and so on…

I am asking this because I have never thought about the Endian-ness of my ByteBuffers, but after seeing some other questions on SO and the performance impact it can have, it seems worth it or at least something I should become more aware of when utilizing ByteBuffers.

Or maybe there is a down-side here to worrying about endian-ness I am missing and would like to be aware of?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:32:28+00:00Added an answer on May 29, 2026 at 10:32 pm

    It points out in the article you quote that the difference is pretty small. (Possibly none)

    The results quoted don’t show a consistent improvement and using the latest JVMs may close the gap.


    • When I enable “native byte ordering” (which is actually unsafe if the machine uses a different ‘endian’ convention):
    mmap: 1.358
    bytebuffer: 0.922
    regular i/o: 1.387
    
    • When I comment out the order statement and use the default big-endian ordering:
    mmap: 1.336
    bytebuffer: 1.62
    regular i/o: 1.467
    

    There is a measured difference but its small in the overall scheme of things. If you want it to be much faster, the only option I have found which makes a big difference is using Unsafe directly, in which case only native ordering is available.

    Even then it only helps in the most latency sensitive applications.

    Unsafe is even more interesting with code and comments. 😉

    http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/sun/misc/Unsafe.java

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm part of a team that develops a pretty big Swing Java Applet. Most
How big task is it to implement support for Arabic localization, our Java 1.5
We know the endian is related to the way how computers store data. Big
I am reviewing a big java application to see if there are any performance
I've got one really big .java class file that has a lot of members.
i'm using java on a big amount of data. [i try to simplify the
I'm creating some big files (DB exports) with Java and I need to put
I've a big GWT module which comprised of many java classes (& of course
I always hear that Java being open-source is a big benefit, but I fail
While compiling a program in Java I got this big WARNING warning: [unchecked] unchecked

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.