Summer classes and work in IT have kept me busy the past few months, but I've found time here and there to tweak my setups and work on the hyperkaos engine. Name of the game has been functional minimalism.
I've been using loksh as my shell on all my machines for the past couple months, and I'm really loving it. At 1/5 the size of bash, and with the "keep the cursor-area centered on the screen for very long command lines" feature, it's been a refreshing experience. At first I missed my prompt colors, but I don't really anymore. Otherwise, I'm supplementing coreutils with plan9port/9base, and you can see in the screenshot my little shell function to give "list-directories-first" functionality to the plan9 ls. Considering the "cat -v considered harmful" attitude, I am a bit suprised that plan9port cat is actually bigger than the GNU cat, but every other plan9port utility I commonly use is significantly smaller and faster than the GNU alternative. Pretty nice.
Scripting-wise, I've been porting my tiny scripts to posix-compliant versions calling /bin/sh. Nothing terribly exciting, but good practice.
My xfce4-panel setup as of late has become a bit more traditional, although systray on the left might seem alien to most. I see the systray + window buttons as a contiguous region, with the desktop switcher and clock (and battery percentage indicator on the laptop) all hugging the right edge.
I had been planning to convert the hyperkaos engine to pure C for a while, but after an incident in my Data Structures class this summer I was completely done with C++ for any personal projects. It goes like this:
Shared and weak pointers are supposed to alleviate the pain of manual memory management, right? Our instructor heavily suggested we use them. So, we (my partner and I for this specific project) were using them. The project was a simple networking project. Given a long list of pairs of names, put together group structures with the correct members and then list a minimum list of new connections to unite all the groups into one. So we had a simple hash table where a name lookup could give you a node containing the name string and the group ID, which was a weak pointer that eventually led to the root node of the group. We used shared pointers for everything else (ie the buckets and next-pointers for our collision handling, and the pointer-objects for our entry entities themselves).
Everything was going well, until we had to test our program's speed with a very large dataset. It was 10x slower than we wanted... So after setting up a gprof on the program, guess what I found...
The weak and shared pointers were slowing everything down, causing that 10x drop in performance! Reference counts, locking, etc, was taking 85% of the runtime of the program! So I did a quick edit and converted all the pointers to raw pointers, did manual cleanup in the destructors, and our speed improved to within nominal levels.
So that was it. With the exception of generics, there's no reason to use C++ for anything as far as I'm concerned. I've converted the hyperkaos engine to C from C++ with no ill-effects, and with cleaner architecture and smaller binary size to boot. New features since the last blog post include some new Kaos types, a basic config.h, sound, and a rudimentary cutscene engine.
Stay frosty, my nerds!