Files on XP: Is "Last Access Time" Disabled Safely?

I am desperately looking for cheap ways to reduce build time on my home PC. I just read an article about disabling the last file access attribute in Windows XP, so simple reads don't write anything back to the disk.

It is also very simple. At the DOS prompt, type:

fsutil behavior set disablelastaccess 1

Has anyone ever tried it in the context of C ++ projects ? Any flaws?

[Change] More on the topic here .

+6
c ++ performance file-io windows-xp
source share
9 answers

From SetFileTime Documentation :

"NTFS delays updating to the last file access time for up to one hour after the last access."

There is no real point to disable this - the original article is incorrect, data is not written with every access.

EDIT:

As to why the author of this article claimed to be 10x faster, I think he explained his speed for a different reason: he also turned off 8.3 generations of file names. To generate the 8.3 filename for a file, NTFS should basically generate each feature in turn, and then see if it is already in use (without a link, I'm sure Raymond talked about this, but cannot find the link). If your files have the same first six characters, you will be bitten by this problem, and in your browser you should put the characters that distinguish the files in the first six characters so that they do not collide. Disabling the short name will prevent this.

+7
source share

I have not tried this in a Windows window (I will be tonight, thanks), but a similar thing in Linux (the noatime option when installing a disk) accelerated the process significantly .

I canโ€™t think of any applications when the last access time would be useful, except for audit purposes, and even then Windows stores the user who accessed it? I know that Linux is not working.

+4
source share

I suggest you try it and see if this has changed.

However, I am pessimistic about this, which really matters, since in large / clean assemblies you will still record large amounts of data, so adjusting the access time to the file will not take much time (plus it will probably be cached anyway).

I wish I were mistaken.


Results:

Develop several code-based builds that work both in the debug configuration and in the release with the latest access time enabled and disabled.

Our source code is about 39 MB (size 48 MB on disk), and we will build about half that for the configuration that I created for these tests. In the debug assembly, 1.76 GB of temporary and output files are generated, while the release generates about 600 MB of such data. We build on the command line using a combination of Ant and Visual Studio command-line tools.

My machine is a Core 2 Duo 3GHz, with 4 GB of RAM, 7200 rpm hdd, running on Windows XP 32 bit.

Build with last access time disabled:

Debug time = 6:17, 5:41

Release time = 6:07, 6:06

Build with the latest access time enabled:

Debug time = 6:00, 5:47

Release time = 6:19, 5:48

In general, I did not notice any difference between the two modes, since in both cases the files are most likely in the system cache, so it should just read from memory.

I believe that you will get the biggest bang for your buck just by using the correct precompiled headers (rather than the automatically generated ones that Visual Studio creates in the project). We implemented this several years ago at work (when the code base was much smaller), and it reduced the build time to a third of what it was.

+4
source share

This is a good alternative, but it will affect some tools. Like the remote storage service, and other utilities that depend on file access statistics to optimize your file system (for example, Norton Defrag)

+1
source share

this will slightly improve performance. Other than that, it wonโ€™t do it anymore (you wonโ€™t be able to see when the file was last available, of course). I had it by default when I install Windows XP using nLite , to cut the bells and whistles I do not need.

0
source share

I do not want to distract attention from the issue of "last access time", but there may be other ways to speed up your builds. Not knowing the context and settings of your project, it's hard to say what can be slow, but there may be some things that can help:

Create the "uber" assemblies. That is, create a single compilation uber.cpp file that contains a bunch of lines like

 #include "file1.cpp" #include "file2.cpp" 

You may have problems with conflicting static variable names, but they are usually easy to understand. The initial setup is pain, but assembly time can increase dramatically. For us, the biggest drawback is that in the development studio you cannot right-click on a file and say โ€œcompileโ€ if this file is part of the uber assembly. But it is not important. We have separate build configurations for "uber" builds that compile uber files but exclude individual cpp files from the build process. If you need more information, leave a comment, and I can understand this for you. In addition, the optimizer tends to do a slightly better job with uber builders.

Also, do you have a large number of included files or many restrictions between include files? If so, this will significantly reduce assembly time.

Do you use precompiled headers? If not, you can look at this as a solution will also help.

Slow build time is usually tracked to a large number of file I / O. This is by far the biggest time it takes to build - just opening, reading and analyzing all the files. If you reduce file input / output, you will improve build time.

In any case, I'm sorry, I approached the topic a little bit, but the proposal to change how the file access time was set recently seemed to be the solution to the โ€œsledgehammerโ€.

0
source share

For busy servers, disabling last access time is usually a good idea. The only potential drawback is the presence of scripts that use the latest access time, for example, to say that the file is no longer being written.

However, if you want to improve the build time of a C ++ project, I highly recommend reading Recursive Make considered harmful . The article is about ten years old, but the points it makes about how recursive definitions in our build scripts cause long build times are still worth understanding.

0
source share

Disabling access time is useful when using ssd (solid state drives - cards, USB drives, etc.), since this reduces the number of writes on the disk. All SSDs have a lifetime, which is measured by the number of records that can be made for each individual address. Some media outlets indicate a minimum of 100 thousand and about 1 million. Operating systems and other executable files can access many files in a single operation, as well as access to user documents. This applies to eee pc, embedded systems and others.

0
source share

Mike Dimiku:

Try plugging in a USB drive with many files and copying them to your internal drive. This is also the case in addition to compiling the program (which is described in the original publication).

-one
source share

All Articles