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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:13:10+00:00 2026-05-26T22:13:10+00:00

(This isn’t my program, but I’ll try to provide all the relevant information to

  • 0

(This isn’t my program, but I’ll try to provide all the relevant information to the best of my knowledge.)

There is a program which reads binary files that are roughly 300MB in size, processes them and outputs some information. The program uses ifstream for file input and streams are correctly initialized and closed for each read.

The program has to read each file multiple times. Reading a file for the first time takes about 3 seconds, and each consecutive read takes about 0.1 seconds. If several files are processed, going back to the first file will still yield fast read speeds, but after some time re-reading a file becomes slow.

Additionally, if a file is copied to another location, the speed of the first read of the new file is roughly 0.1 seconds.

If you do the math, the speed of consecutive reads is roughly the advertised read speed of the hard drive.

All this looks like file locations are cached by either the OS or the hard drive, so that on consecutive reads you don’t have to seek out file locations.

Does anyone know what exactly is causing the slowdown on the initial read, and if it can be prevented? Three seconds may not seem like a lot, but they add about 5 hours to the total time needed to correctly process every file.

Also, the program runs on Fedora 14 and Scientific Linux, with both OS’s having their default file systems.

Any ideas would be appreciated.

  • 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-26T22:13:11+00:00Added an answer on May 26, 2026 at 10:13 pm

    Linux will try and copy the file into RAM to make the next read faster – I am guessing this is what is happening. The initial read is actual off disk – subsequent reads are out of the file cache because the entire file has been copied to RAM

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

Sidebar

Related Questions

This isn't easy to explain, but I'll try my best. The issue has started
I know that this isn't exactly normalised, but bringing all of the localised data
This isn't really a programming question... Are there any ways to determine which application
This isn't strictly a programming question, but hopefully someone here has the knowledge to
This isn't a holy war, this isn't a question of which is better. What
This isn't a question but I thought I'd start a thread where links to
This isn't really a programming question but more about programming and testing tools. Is
This isn't a matter of me being stuck, but rather I'm looking for a
This isn't a problem as such, but it's bugging me and I would appreciate
This isn't a very simple question, but hopefully someone has run across it. I

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.