I've been writing a program which reads many dozens of files.
Running it from PB, I find that the first time I run the program (after restarting the computer), it takes a while to "warm up". But running it the second time, it's much faster.
Why would this be happening? Are recently-opened files held in RAM, or in the CPU cache?
Why would a program run faster the second time?
-
Seymour Clufley
- Addict

- Posts: 1266
- Joined: Wed Feb 28, 2007 9:13 am
- Location: London
Why would a program run faster the second time?
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
Re: Why would a program run faster the second time?
Yes, probably. Windows caches files etc. to some extent. Don't know enough about it though.Seymour Clufley wrote:Are recently-opened files held in RAM, or in the CPU cache?
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
-
MachineCode
- Addict

- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: Why would a program run faster the second time?
Yep, the files are cached. Tip: When your app is first run, and is idle, do a background read of the files. Then when the user wants to read the files later, it'll be lightning fast. 
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!