Site icon Random Thoughts

Emacs Screensaving Redux

Yesterday, I tweaked my toy Emacs screensaver to display images, and discovered that that was very slow indeed.

Today I started actually benchmarking this stuff instead of just guessing what was taking all that time, and surprise, surprise, the problem wasn’t where I thought it was at all.

Instead it was in the xelb library, where it would do a pessimal conversion of strings into bytes. With a three-line patch, it now takes 0.06s to convert one of these xcb:PutImage objects into a byte array, where it previously would take 0.8s.

Look!

https://lars.ingebrigtsen.no/wp-content/uploads/2020/07/speed.mp4

Now it almost looks like it’s doing the images that way on purpose and not because that’s how fast it can go!

I really like the xelb library: It’s very clearly structured and is written in a very correct way. But I’m guessing that nobody has tried using it for something as wacky as this before.

I’ve now sent a patch to the maintainer.

Exit mobile version