Rickard's Newsletter

Archives
May 1, 2026

April 2026: More C programming

This month I got into C programming and Computer, Enhance! again.

One program that I worked on was a program to print unique lines:

rick@fedora:~/projects/cunique$ cat test.txt
hello
world
hello
there
rick@fedora:~/projects/cunique$ ./cunique <test.txt
hello
world
there

I managed to write it, but I also wanted it to perform well. When I tried the above with a 1GB file it seemed to take forever, but my Python equivalent finished in around 5s.

That made me feel discouraged and made me think that I should work more on Computer, Enhance! before I think I have an idea about how to write performant C code.

So that is what I did.

I started and finished part 2 where you end up writing a block profiler to instrument code. I published mine at rlprofiler. I'm sure it will continue to evolve as I get further into the course and use it for more projects.

The profiler is written as a library that should be easy to deploy in C applications. I'm struggling a bit how to design C libraries. It is different from the OOP style that I'm used to. But it is also fun.

Then I started on part 3 where you write a "repetition tester". I based mine on rlprofiler. I might integrate it into rlprofiler. The idea behind a repetition tester is that there is too much variability when you time a piece of code. The time might depend on OS and CPU caches for example. By doing a test over and over again, we can see how our code performs given that those external factors are totally in our favor.

I want to design the repetition tester as a library as well. And again I'm struggling with the interface. One way to flesh out the interface is to use it in more applications. So perhaps a next step is to deploy my profiler and repetition tester in rlworkbench.

Everything is suddenly coming together. One of my projects feeds the next and so on. And as suddenly, I might get sidetracked with another interest.

Being immersed in C this month inspired me to write the following blog posts:

  • How to write portable programs in C?
  • Where to put the star in a C pointer declaration?

Lastly, I made a release of Timeline. The updated release instructions worked fine with the new code hosting platform.

TODO

Here are the things that I'm currently most interested in working on next month:

  • rlworkbench
    • Deploy my profiler and repetition tester
    • Think about how to use it to create a game dev environment for kids
    • Start using rlworkbench instead of Vim as my default text editor
      • Implement the features that I'm missing
        • Search function for quicker navigation
        • Ability to open files
        • w and b to move forwards/backwards a "word"
          • A "word" should be defined by the language?
  • My blog
    • Migrate all blog posts to it
    • Fix redirects
      • For blog posts
      • For pages: rickardlindberg.me/projects/x -> projects.rickardlindberg.me/x
        • Same for tags?
    • Syndicate projects to Github
    • Display mentions on blog posts
      • Better handling of dates (use date of post if present)
    • Make different post types render nicely
      • Icons?
  • Computer, Enhance!
    • Continue course and do more homework
Don't miss what's next. Subscribe to Rickard's Newsletter:
rickardlindberg.me
Powered by Buttondown, the easiest way to start and grow your newsletter.