Rickard Lindberg | Blog | Projects

Written by Rickard Lindberg Profile picture of Rickard. in #c

One thing that I find easier in C compared to Python is that loops are not as expensive. And sometimes, things are easier to implement when you can think of them individually.

For example, to render characters with different styles, we can do this in C:

for (index = 0; index < SIZE; index++) {
    render_character(characters[index], styles[index]);
}

This is cheap in C. But in Python, it is expensive. So to make this fast in Python, we might want to do something like this:

for (substring, style) in split_parts(text):
    render_text(substring, style)

Assuming we can write split_parts without looping over all characters, this will perform better in Python because of fewer loop iterations.

2026-08-02 week 31

What is Rickard working on and thinking about right now?

Every month I write a newsletter about just that. You will get updates about my current projects and thoughts about programming, and also get a chance to hit reply and interact with me. Subscribe to it below.

Powered by Buttondown (My Newsletter)

Profile picture of Rickard.

I'm Rickard Lindberg from Sweden. This is my home on the web. I like programming. I like both the craft of it and also to write software that solves problems. I also like running.

Me elsewhere: GitHub, Mastodon.