Wednesday, February 27, 2013

More Shell Scripting!

A quick program I wrote for testing runtimes.
Actually, I was testing the testing of runtimes.
Gotta love testing!
So I wrote version one of my testing script on Monday and ran it on ASU's server. It did alright but there were some errors and I was not certain that the runtime data I was getting could be trusted. This is because I was using the GNU date command, which is supposed to fetch the current UNIX time in milliseconds since the last epoch, in 1970. As you can probably tell, that is a very large number. So large, in fact, it would sometimes overflow the variable's range, and I was sometimes getting ridiculous negative numbers. So, back to the drawing board. Today I built a small program in C++, as shown to the right, that calculates the first million Fibonacci numbers, which only takes about 0.117 milliseconds. I can use this program as a target for my runtime testing script while I'm debugging it.

So that's what I've been doing, testing and writing and testing and writing. I'm learning a lot about shell scripting, about C++, and about Computer Science in general. I've been using an amazing tool I found, called TextMate. It is an open source text editor specifically designed for programmers. It can compile and run just about any programming language you throw at it, all inside the app. It's very impressive. I actually just talked to the main developer, Allan Odgaard, yesterday on IRC and told him so. I would highly recommend this to any of my fellow programmers running OSX.

Thanks for reading!

- Jeff

3 comments:

  1. Cool Jeff! You must be learning a lot. There is no faster way to learn a program than by testing and writing, or writing and testing.

    ReplyDelete
  2. So both Java and C++ handle overflow with throwing negative number.
    Very impressive that the running time for millionth Fibonacci was only 0.117 ms.
    Was it great talking to top notch?

    ReplyDelete
  3. It was. I really like to see programmers like Mr. Odgaard who continue to invest hours of work into their programs for simple things like small bug fixes and user support. It shows great commitment and responsibility.

    ReplyDelete