Coding better helper tools

Project Page Next project post Post History

One of the things I've been able to do in my time is write little programs that help me write code. The rave of the day is all about artificial intelligence (AI), which can write code for you. I find this a little funny, as I wrote my own tools to write code well before AI was ever a thing in the public eye!

Having now be in the position where I can almost use my tools for a small production, I've turned some attention to updating one of these helper tools to find a better way of doing things. They started off as experimental objects and dialogs, just places I could learn to code and experiment with various code things. They've since become handy little tools themselves, good little test beds for various coding things.

One of the tools I wrote helps me translate an image into code, so that I can bury icons and images inside my own programs. I know this isn't strictly a necessary thing, but it is handy as it means less files to have to manage when installing the plugins, and is very quick to load as it's already loaded into memory - no having to parse files from disk etc. And while I was toying with the idea of adding in a little more functionality to the image code printer, I realised I could make a much more efficient way of turning an image into code. So, I got to it, spent a couple of hours adding in redesigning newer functionality, and hey-presto, an updated tool.

Being able to print an image into code means I can make header files that just build images. I tested the newer code out in a small tool build and it was surprisingly faster. A couple of days later and I was back inside trying to add new stuff to my ProxyMan tool, and I decided that it might be worth trying to update the image code file there into the newer version. And wow, was it worth it! It's actually decreased build times for the ProxyMan tool by several minutes! As an example, the image code file for building the ProxyMan images programmatically was 44,949 lines of code. The equivalent and updated version now has 11,513 lines of code. That's nearly a 75% reduction in the number of lines of code! This makes much less work for the compiler to have to deal with. But that's not all...

The build times for ProxyMan used to take around 10 minutes to compile. I managed to get it down to 6-7 minutes some time ago when I removed a lot of embedded things I decided it no longer needed. But now, with the newer image code header files, the first build time came in at 24.336 seconds! And a 64-bit build of the same tool was done in 28.569 seconds!!! This is coming down from 10 minute build times - this is something in the order of a 95% reduction in build time! I'm impressed with this, that's quite a significant drop.

To put that into some perspective, I can now build the project, open Cinema4D to test the tool, close it, edit more code etc. and do this several times in the same time it used to take to just build once. It's really improved the build performance. And it's just made things far quicker to edit, fix, compile and rebuild projects, especially the larger ones.

A really worthwhile exercise.