"simple X11" is just X11, a WM, and a hotkey daemon. No bars.
The difference between "infofeld" and "infofeld full" is that I didn't
port all the widgets from Python to C. So, "infofeld full" is my
previous setup and "infofeld" is the old Python code but with only those
widgets active that have also been ported to C. In other words, just by
removing some widgets that I don't actually need, the load drops
significantly.
Now, take this with a grain of salt. It's just a rough estimate.
Another rough estimate: The CPU in my desktop workstation runs about 10
degree celcius cooler now.
Porting from Python to C doesn't account for the entire boost, I guess.
It's more about avoiding forks and execs. In the original infofeld, each
widget was a Python script that had to be called *once for each frame*.
So, there was a loop (in a shell script) like this:
while true
do
infofeld-cpu
sleep 1
done
For each widget, there was such a loop. Very convoluted, lots of
processes being created and killed. Plus, many of those processes are
Python processes which have quite some overhead:
$ time python3 -c ''
real 0m0.018s
user 0m0.015s
sys 0m0.004s
Worse, infofeld is supposed to create farbfeld images -- but infofeld
uses cairo for drawing and cairo does not expose a `surface.get_data()`
function to Python. That function only exists in the C library. This
means that the original infofeld had to create a PNG file and then pipe
that to farbfeld's `png2ff` tool. Even more processes!
At the moment, I don't see how this can be optimized further while still
keeping the original architecture: bevelbar is the actual X11 program
that displays the bars and you have to tell it, "display the image in
/tmp/foo.ff". So, the current setup with infofeld2 looks like this:
while sleep 1
do
echo ... tell bevelbar to display battery.ff ...
echo ... tell bevelbar to display cpu.ff ...
echo ... tell bevelbar to display net.ff ...
done | bevelbar
Widgets like `infofeld2-cpu` now loop on their own and recreate the
image file about once per second.
I think the only way to improve performance now is to integrate infofeld
into bevelbar itself, to save all the round-trips and communication. I'm
not sure if that's worth it. It would make bevelbar a rather complex
program.