OLD | NEW |
(Empty) | |
| 1 [Motivation] |
| 2 This tool is to compare the time cost of creating temporary files between using |
| 3 GetTempFileName() Windows API and using the GUID-based method, especially when |
| 4 there are already tens of thousands of temporary files in the target directory. |
| 5 |
| 6 The problem setting can be referred to |
| 7 https://bugs.chromium.org/p/chromium/issues/detail?id=711534 |
| 8 |
| 9 [How to use it] |
| 10 Please download the files (.cc, .sln, .vcxproj) and compile the code in Visual |
| 11 Studio. Run "CreateTempFilesPerfEval.exe" either from the build directory or |
| 12 from Visual Studio. No parameters are needed. This tool allows interaction with |
| 13 the users. Once launched, you will see the following message on the console: |
| 14 |
| 15 "Please enter # of files to create |
| 16 (maximum 65535), or "quit" to end the program :" |
| 17 |
| 18 Simply type in a number less than 65536 (e.g. 1000) and you will see: |
| 19 |
| 20 "Please select method to create temp file names, |
| 21 "t" for GetTempFileName |
| 22 "g" for GUID-based |
| 23 "b" for both |
| 24 or "quit" to end the program :" |
| 25 |
| 26 Just select the method(s) you want to try (e.g., "b"), and you will get output |
| 27 like below: |
| 28 |
| 29 GetTempFileName Performance: |
| 30 created / total --- time cost in ms |
| 31 500 / 1000 --- 403 |
| 32 1000 / 1000 --- 402 |
| 33 File creation succeeds at |
| 34 C:\Users\chengx\AppData\Local\Temp\TempDirGetTempFileName\, now clean all of the
m! |
| 35 C:\Users\chengx\AppData\Local\Temp\TempDirGetTempFileName\ directory is deleted! |
| 36 |
| 37 GUID-based Performance: |
| 38 created / total --- time cost in ms |
| 39 500 / 1000 --- 412 |
| 40 1000 / 1000 --- 411 |
| 41 File creation succeeds at |
| 42 C:\Users\chengx\AppData\Local\Temp\TempDirGuid\, now clean all of them! |
| 43 C:\Users\chengx\AppData\Local\Temp\TempDirGuid\ directory is deleted! |
| 44 |
| 45 It shows the time cost of creating every 500 temp files in milliseconds. |
| 46 |
| 47 The temporary directories are created in the "Temp" directory as shown above. |
| 48 The temp files are then created in the newly created temporary directories. |
| 49 All of them are deleted by the program automatically. If the deletion fails for |
| 50 some reason, you will see: |
| 51 |
| 52 "[Attention] C:\Users\chengx\AppData\Local\Temp\TempDirGuid\ directory's deletio
n |
| 53 fails, please take a look by yourself!" |
| 54 |
| 55 |
OLD | NEW |