News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

execution time of masm32 program

Started by bert35, March 26, 2011, 03:22:31 PM

Previous topic - Next topic

bert35

I am new to masm32 and I am studying the examples in the \masm32\examples\ folder. The example findfile, which is in  masm32\examples\exampl05\findfile\ must be executed as findfile <filename>. When this is done right after Windows start up it takes about 70 seconds. When I repeat the same findfile<filename> it only takes 3 seconds. So only the first execution takes 70 seconds. Can somebody give an explanation?   My system is Windows XP SP3. 

Tedd

When you open a folder, the OS obtains a list of the files in that folder. It caches this list so it can be obtained quickly next time. On startup, many paths have not been opened yet, so they are missing from this cache. The first time you run your program, the paths accessed are added to the cache. The next times you run it, they're already in the cache and so it runs much quicker.
No snowflake in an avalanche feels responsible.

bert35

I wondered what would happen if, after the first execution, I would rename or delete one of the found files. It appeared that the list in the cache is then updated accordingly.

clive

The media onto which the file systems structures are written is the thing being cached. The file you renamed represents a very small fraction of the total data and structures cached.
It could be a random act of randomness. Those happen a lot as well.

Tedd

The cache is still kept in synch - when you make a change, it's changed first in the cache; the actual disk structures are updated 'later' (in the background, whenever it's convenient for the OS.)
No snowflake in an avalanche feels responsible.