The Costa GUI
The Costa GUI

Continually optimizing, and replacing icons

Posted on the 2nd of May, 2022


Work on optimizing Costa continues. Some time ago, I wrote about how all image and config files were replaced with binary files, rather than the human-readable formats they were in. This had a couple of advantages in regard to speed. Firstly, loading a single blob of data from disk is much faster than reading in text line by line (as was previously done.) Secondly, since the data is stored in the native format used in memory, no parsing is necessary. As soon as data is loaded from disk, it is immediately ready to be used.

There was still a few files saved in text format - the font files. These font files were made by Rush Soft (Joran Kok, Peter Jonk, Wouter Lenis) for the GUI Rush, for which credit is of course included with Costa. I originally extended these font files with data about character width, so that text could be easily centered in Costa by a function returning the width in pixels of a string. Now, these font files have also been converted to binary format, loaded in a single read operation.

I did some testing on my 386 PC, by coding a routine that loaded the fonts 100 times in a row using the old and the new method. Mind you, these tests were performed with SmartDrive disk cache running, but since that is listed as a recommendation in Costas system requirements, I figured that would be representative of real-world usage.

Loading the fonts 100 times with the old font format took 53.32 seconds. Using the new font format, that time was reduced to 6.36 seconds - a reduction of 88%. Quite decent, even though it does of course mount to little time when actually using Costa. But, with so many of these types of speed improvements over the last year, I can say without a doubt that Costa has gone from barely usable on a 16 MHz 386 PC to actually performing quite nice. So, I am quite happy with the progress made!

In other news, I have started work to replace most of the icons used in Costa. They were mostly icons borrowed from Windows 3.x, Windows 95 and Windows 98. I want to rid Costa of these as they are Microsoft’s property, and I want as much as possible of Costa to be made by myself. This will of course give Costa a different visual expression, and given that I am no graphical expert, this is quite a challenge for me. But, I’m sure I will manage to get most icons replaced soon, and get the next version of Costa out. I feel like there’s been so many changes since the last release, that a new version is overdue. A coming feature I have yet to write about here is the ability to switch Costa between EGA and VGA mode on the fly. Stay tuned!