Roland's homepage

My random knot in the Web

Articles about programming

  1. Statusline program in C for i3 on FreeBSD

    This program started out as a Python script, which generally worked fine.

    It would however crash every now and then after running for a long time. In an effort to find what was causing that I started logging exceptions to syslog. This did not result in any clues.

    It is a bit silly to have a complete python interpreter running to produce a statusline. So I decided to rewrite it in C.

  2. Writing C in 2024

    To learn how it works and because I don’t use Java, I decided to port professor Michael Pound’s implementation of the Enigma machine and the fitness and analysis code.

    The initial port was done to Python. Unfortunately, this is one instance where Python was rather slow because of the large amount of settings that need to be tried.

    So I decided to port it to C instead.

  3. Profiling with pyinstrument

    After having used the built-in tracing profiler cProfile for a while now, I came across the statistical (sampling) profiler pyinstrument.

    A statistical profiler does not influence the runtime of the program as much as a tracing profiler as cProfile does. Additionally, pyinstrument shows the result in a different way from cProfile.

    So in this article, I will be profiling my repotool program. This program helps me maintain a mirror of FreeBSD packages that I use.

  4. On Python speed

    As an engineer, I write a lot of small python programs as tools for specific tasks. Generally, these are not large programs. Most of them are below 100 lines of code (“LOC”, as measured by cloc), although there are a few in the 300−400 LOC range.

    In this article, I will present some observations about these, and draw some conclusion from them.

  5. Python 3.11 speed comparison with 3.9

    Since Python 3.11.0 came out recently, I wanted to compare its speed with 3.9.15 on some of my own “benchmark” programs.

    Both versions are in the default configuration as built by the FreeBSD ports system.

    TL;DR Python 3.11 yielded speed improvements in the order of 25% in my tests.


Page 1 / 4 Page 2 →