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

  • SEARCH
  • Home
  • 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 8141583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:33:32+00:00 2026-06-06T12:33:32+00:00

In java there is an optimal buffer size of 32 Kb which is based

  • 0

In java there is an optimal buffer size of 32 Kb which is based solely on the cpu architecture being used. On Android phones does the Dalvik VM dynamically know the proper cache of the cpu to get the largest buffer size independent of the many different phones out there? If so how would I figure that out at runtime?

Say I want to optimize a audio recording activity by making the buffer the largest it can be and also the fastest. I know you can get the minimal size for it but what about the optimal size?

  • 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-06-06T12:33:34+00:00Added an answer on June 6, 2026 at 12:33 pm

    Maybe it depends on what device you have or mind.

    However, experimentally, 8K < buffer size < 32K does work well and there are significant performance improvements under 8K. Somewhat interesting is that some data with buffer > 64K showed poorer performance than data with under 64K buffer

    (I’ve tested on several android devices and tried to read 20MB binary file with various buffer size.)

    Here’s exp result and you’d better to paste them to spreadsheet if you wanna convert data in pretty form. header means buffer size and units are millisecond

    graph: http://fb.com/photo.php?fbid=468345876512381

                       128     256     512     1K      2K      4K      8K      16K     32K     64K     128K    256K    512K    1M      2M      4M      8M      16M
        Galaxy S       4047    3060    269     155     100     65      64      52      51      45      47      50      49      43      44      46      45      58
        Optimus LTE    1178    617     322     172     101     65      47      42      41      35      36      39      44      61      56      51      72      60
        HTC EVO        3971    1884    941     480     251     141     95      69      56      50      48      55      50      49      48      48      48      47         
        Galaxy S2      750     383     210     123     74      50      41      37      35      34      34      37      39      44      46      44      45      44
        Galaxy Nexus   2272    1216    659     341     187     108     70      52      41      38      38      45      44      54      56      66      68      58
        Galaxy Note    1549    799     404     220     127     75      58      54      52      56      52      45      44      62      43      39      44      46
    

    InputStream in = openFileInput(FILE_NAME);
    startTime = System.currentTimeMillis();
    
    while (in.read(buffer) > 0) {
        readCount++;
    }
    
    elapsedTime = System.currentTimeMillis() - startTime;
    

    enter image description here

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

Sidebar

Related Questions

Which of the following would be more optimal on a Java 6 HotSpot VM?
In my Java application there is a Socket open and data is being read
In Java there are methods to go about scanning the classpath/all classes/within a package
When designing an distributed application in Java there seem to be a few technologies
I have read a document that they say: In java there two types of
Possible Duplicate: Should C++ eliminate header files? In languages like C# and Java there
In Java is there any way to store time ranges as key in Hashmap
For Java SE there are several JVM's available for running in production on x86:
In Java is there a way to extract the value of an unknown subset
In my jsp page some pure java code there i.e, scriptlet. After a long

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.