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 9244599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:04:32+00:00 2026-06-18T09:04:32+00:00

I have arrays like byte[] b = new byte[10]; byte[] b1 = new byte[1024*1024];

  • 0

I have arrays like

byte[] b = new byte[10];
byte[] b1 = new byte[1024*1024];

I populate them with some values. Say,

for(i=0;i<10;i++){
     b[i]=1;
}
for(i=0;i<1024*1024;i++){
     b1[i]=1;
}

Then I write it to a RandomAccessFile and read again from that file into the same array using,

randomAccessFile.write(arrayName);
              and
randomAccessFile.read(arrayName);

When I try to calculate the throughput of both these arrays(using the time calculated for file read and write) of varying sizes(10 bytes and 1Mb), throughput appears to be more for 1MB array.

Sample Output:
Throughput of 10kb array: 0.1 Mb/sec.
Throughput of 1Mb array: 1000.0 Mb/sec.

Why does this happen? I have Intel i7 with quad core processor. Will my hardware configuration be responsible for this? If not what could be the possible reason?

  • 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-18T09:04:34+00:00Added an answer on June 18, 2026 at 9:04 am

    The reason for the big difference is the overheads involved in I/O that occur no matter what the size of data being transferred – it’s like the flag fall of a taxi ride. Overheads, which are not restricted to java and includes many O/S operations, include:

    • Finding the file on disk
    • Checking O/S permissions on the file
    • Opening the file for I/O
    • Closing the file
    • Updating file info in the file system
    • Many other tasks

    Also, disk I/O is performed in pages (size depends on O/S, but usually 2K), so I/O of 1 byte probably costs the same as I/O of 2048 bytes: A slightly fairer comparison would be a 2048 byte array with a 1Mb array.

    If you are using buffered I/O, that can further speed up larger I/O tasks.

    Finally, what you report as “10Kb” is in fact just 10 bytes, so your calculation is possibly incorrect.

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

Sidebar

Related Questions

I have two arrays of values like X,Y,Z and 1,2 There is a table
I have to write byte arrays in a file. I can't do it in
I would like to write a byte arrays in a file with Camel. But,
I have a JNI function byte[] read() which reads some bytes from a particular
I have an SHA-1 byte array that I would like to use in a
I have arrays like this. [11] => Array ( [transactioncurrencyid] => Array ( [!name]
i have two arrays like this first array Array ( [0228] => Array (
I have 3 arrays like this: 1st Array ( [0695] => Array ( [loan_number]
Suppose I have two arrays like the following: $arr2 = array(array(first, second), array(third, fourth));
Are there any C++ (or C) libs that have NumPy-like arrays with support for

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.