why does my program take long to access files the first time [closed]

Welcome to Programming Tutorial official website. Today - we are going to cover how to solve / find the solution of this error why does my program take long to access files the first time [closed] on this date .

So I have this program that goes through a bunch of mp3 files in a folder and reads some data off of them. When I run it, it takes a while. That seemed fair enough. But when I run it again after the first time, it doesn’t take all that long. How can that be !?

I’m using a windows machine and the program is a python script.
If you want to have a look at the script Here is the link

Answer

As commentators have remarked: Operating systems and hard-disk subsystems perform several types of Disk Caching to speed up re-reading a file that was recently read.

Your program is initially slow because it probably reads a large amount of data from a large number of largely-fragmented large-sized files scattered over a large area of the disk.