Betrayal

Published 08/02/2021

I recently published a blog post describing my adventures in C, feeling quite proud of what I had learnt and the progress I had made on the project. These feelings were short lived, as I soon received on message on Signal (A superior messenger!) from one of my friends with a github repository entitled "better-interval-timer". This friend had rewritten the entire program in Rust, with scathingly passive aggressive comments about my original project.

In comparison, my project seemed like a slow, bloated version of the so-called "better" version. They had managed to reduce my 15s over 30m drift to - ready yourself - 00.230 How? How? What rusted black magic was going on behind the scenes?

The Almighty Power of Threads

Wiktionary defines a thread as "A long, thin and flexible form of material, generally with a round cross-section, used in sewing, weaving or in the construction of string". Now, although I was feeling quite like a severed thread, the relevant definition is "A unit of execution, lighter in weight than a process, usually sharing memory and other resources with other threads executing concurrently". My friend had used the threads to split the program into three threads - one for user input and time output, one for tracking the time, and one for the dings. This optimised the time a huge amount. My blessed clock_t statements were meaningless against this new opponent.

You can read more of the details and find the source code on the user's github page, linked at the top of the article. But, if the wretched creator of better-interval-timer is reading this - which I know they are - know that this is far from over. I will optimise till my fingers fall off; and then I will use my toes; and then I will dictate my code using my voice.

PS: the project doesn't even include cool ASCII text. What's the point?