Currently, this site is generated by 4 shell scripts totaling over 900 lines. When I first made them, they were quite fast, the whole site was able to be regenerated in under a second. However, by the time I got to writing post #6, I realized that it was taking over 1.5 seconds to run. I realized this after I made a change (to have it not write to the final HTML file directly, but instead write to a temporary file, check if the file was different, and then replace the HTML file with the temporary file if so) that more than tripled the run-time of the program, putting it at somewhere between 4.5 and 6 seconds to generate the site. I was able to keep the change and get the run-time down to 2 seconds, but clearly this was getting out of hand.
So, I decided, after much deliberation, that I'd rewrite the page generator in C. After I got started, I realized it'd actually be easier to just have the program generate the entire site. There are 4 main reasons why I decided to rewrite it, and to do so in C. For one, I love C. It's a delightfully simple language, which, for me, is great, because I enjoy recreating the wheel, and that's frequently required in C. What you write is what you get, there's no middle layers or abstractions, which leads into my second point, that C is fast. Ridiculously fast. Now that I have a baseline of an upper limit of how slowly the site can be generated using shell scripts, it will bring me a tremendous amount of joy in writing a program that does the same thing, but is basically as fast as possible. I also decided I'd rewrite it because I realized that there were more features I still wanted to add to the site generator, but that it'd only get slower as I wrote more posts and added more features. Finally, this will give me a good chance to practice what I preach, to write some clean code, to have solid comments, to implement proper error checking. Definitely a lot of the last one, C is so low-level there's a lot more error-checking that should be implemented if you want your program to detect errors and gracefully exit (with nice error messages) instead of crashing with a segmentation fault. Also, just going through the process of working on a sizeable program will give me plenty of material for posts on this site.
Anyways, I'm rewriting the whole thing in C. Due to an unexpected issue I discovered when trying to deal with timezone conversions (that issue being that there's basically no support for it in the C standard libraries), for the purposes of sorting posts on when they were written, and checking to see if a post can be published, I did have to make one concession: the program will spawn a single instance of the program `date` in order to parse dates/times.
I've already made great progress so far. At this exact moment in time that I'm writing this post, it loads in all files but the miscellaneous pages, and I still need to spawn the `date` program to parse post date information. Once I have those two things done, then it should be easy to actually generate the site, because I'll be able to re-use the logic and HTML from the existing site generator scripts. My hope is that I will be able to recreate existing functionality by next week; I'll have an announcement post when it's ready. One of the main features I'm excited about implementing is a "New and Updated Posts" view, preferably on the main page, so if you see that, then you'll know it's working.