What is all this crap (pt 2)

I don’t want to spend a lot of time testing things, so I’m not going run anything else against the whole filesystem. As it happens, I have a recent(ish) source tree for FreeBSD, so I’ll use that to test the various file and directory iteration strategies. For comparison, the extension counting code runs this code in 7.33 seconds.

Likewise, with so many languages to choose from (I’m gonna try about 36), I want to start with a relatively simple set of actions so I can more or less compare fruit with like fruit. So–the first thing I want to do is simply find out more or less how much code it takes to iterate through all the files in a directory tree, and how long it takes to run that code.

Let’s start with a simple C program. A brief aside: I don’t like recursion. It’s unsafe, and it’s not usually better. But it’s easy:

With no output, that’s about 1.7 seconds. Not terrible. But wait, that’s Fabrice Bellard’s awesome tiny C compiler–I *love* that compiler. What if we compile with another compiler? Visual C gives us an about 1.6 seconds with no optimizations, so lets try enabling some…and, nothing. Because this is such a small piece of code, there’s not much to optimize. Instead of checking all the other compilers, let’s move on to other languages.

Stay tuned.