The vim text editor always produce a file ending with a tilde (~) as a kind of backup of the currently modified file (this is a default behaviour). On my MS-Windows machine (Pentium M, 1.73GHz), I was tired of manually deleting these files so I first used the “Search” option in the File Explorer. After some time, I got tired to wait for the results.
So I wrote a Python and a batch scripts to find all these files. They are going much faster than the Search GUI. The first time I launch them, they are still going slow (but faster than a GUI). As you can see in the graph below, the second time I launch these scripts, they went at least 10 times faster. I’m not a specialist but I guess it has something to do with caching at the OS level. For the first run, the batch script is 20% slower than the Python script. After that, the Python script is 50% slower than the batch script (but between 3.7s and 5.6s, the difference is not big).
Here are the scripts : find files ending with ~ in Batch (the problem is that you have to do the duration calculation by yourself), find files ending with ~ in Python and remove files ending with ~ in Python (all scripts are 1kb).
Each of these scripts were run as the first application after my computer was turned on. I didn’t repeated the measures (doing real stats wasn’t the goal anyway). Deleting all the files (after having found them) took 5.4s. It just goes to show what we can do, just before the beginning of a lab seminar.