william

Keep Calm and Markdown.

Profiling zsh: a Python plugin was adding 190 ms to every command

After fixing tmux, I looked at the shell running inside it. My zsh config had grown over a few years to about 30 plugins and Oh My Zsh snippets on top of zinit and Powerlevel10k. It felt a little heavy, but nothing stood out.

Measured properly, it was slow in three separate ways, each with its own cause:

before after
startup to a usable shell 267 ms 101 ms
added to every command 188 ms 3 ms
added to every prompt 15 ms 4 ms

This post covers how I measured each one, the fixes, and how I checked that the fixes didn’t change anything else. That check caught two mistakes of my own.

A Claude Code skill and subagent that write posts for this blog

Most of my recent posts start the same way: I debug something in a Claude Code session, then ask it to “write this up”. Without guidance the result is generic: wrong front matter, a made-up category, marketing intros, and sometimes output that was never actually printed. So I gave the repo two small files that teach Claude Code how this blog works: a skill (blog-post) and a subagent (blog-writer). This post is how they are set up. It was written with the skill.

tmux lag, round 2: every status-bar fork froze the server for 30 ms

Update 2026-10-09: I extended this renderer for a 71-column iPhone client: compact text stopped duplicated bottom status rows while keeping the desktop colors and widgets. See the Termius on iPhone follow-up.

Two days after the last fix, my tmux was laggy again, and the server was back at about a quarter of a CPU core. The culprit was the same as last time: the status bar’s #() jobs. This time, though, the number of jobs wasn’t the problem. Each one had become slow, because every job is a fork of the whole tmux server and my server had grown to 1.5 GB.

This post covers how I measured it, where the 1.5 GB came from (mostly the scrollback of three panes), and the fixes. One of them corrects a claim in my previous post.

Why my tmux was laggy: the status bar was forking a 1.2 GB server 24 times a second

Update 2026-10-02: two days later the lag was back. Each fork of the server had become slow (~30 ms), and one claim below was wrong: passing #{E:#{@quote_cond}} into the job does not work, because tmux does not apply strftime inside a #() command. See round 2.

My tmux had started to feel sluggish. Nothing was broken, it just felt heavy. It turned out the tmux server was using about a third of a CPU core all the time, and nearly all of that went on the status bar. Part of the cost came from the clock workaround in my previous post.

This post covers how I tracked it down, including two wrong guesses, and the fix, which brought the server from ~35% CPU to ~4% without restarting it.

Installing Clash Verge Rev on Ubuntu 20.04 / Mint 20 — and upgrading its mihomo core

Clash Verge Rev is a desktop GUI for the mihomo proxy core (formerly Clash Meta). It is the maintained fork of the original Clash Verge, which was abandoned in 2023. If a tutorial tells you to use zzzgydi/clash-verge, skip it.

On a modern Ubuntu, installing it takes one command. On my Mint 20.3 (focal, glibc 2.31), the latest .deb would not install, and the failed attempt left apt in a broken state. Unlike Claude Desktop and ChatGPT Desktop, there is no clean way to patch around it this time. The practical fix is to run the last 1.x GUI with an up-to-date core.

Linux 时区、系统时间与 tmux 状态栏时间不一致的排查

我把 Linux 的时区设成 Asia/Tokyo,又手动设置了系统时间,但 tmux 右侧状态栏仍慢一个小时。例如,系统显示 14:37 JST,tmux 却显示 13:37 CST。问题不在 timedatectl set-time:一个早已启动的 tmux server 仍按旧时区格式化状态栏。

1
2
3
4
sudo timedatectl set-timezone Asia/Tokyo
sudo timedatectl set-ntp false
# aligned to real Asia/Shanghai time
timedatectl set-time "2026-09-26 15:33:00"
0%