htop vs btop: I Measured Both

– min read

I have hammered htop in every SSH session for over a decade. Then btop landed on a box I was triaging, the graphs moved, the mouse worked, and I admitted it: I had been benchmarking my nostalgia. So I put both on the same Ubuntu 26.04 runner under the same synthetic load and measured what each one actually costs.


Projects at hand: htop (GitHub) and btop (GitHub).


What you need

  1. An Ubuntu or Debian box you can reboot if it gets weird
  2. Both tools from apt: sudo apt install htop btop
  3. Python 3 for the measurement loop, and tmux or any terminal for the runs


sudo apt install htop btop
htop --version    # htop 3.4.1
btop --version    # btop version: 1.4.6
Side by side cheat sheet of htop and btop keyboard shortcuts
Keybinds for both, from the projects’ own docs. Author’s own diagram.

How I measured

No real workload reproduces identically twice, so the load is synthetic and seeded the same way for every run: two busy-spin Python processes and one holder of a 160 MB bytearray. The dataset here is generated, not production traffic, but the point is fairness, not realism. Each tool ran 3 times for 10 seconds on a 120×32 pseudo-terminal while a Python loop sampled /proc/<pid> once per second for RSS and CPU jiffies, and counted the bytes the TUI pushed back to the terminal.

# core of the measurement loop, run 3x per tool
# (load = 2 busy-spin python processes + a 160 MB memory holder)
def run_tool(cmd, dur):
    m, s = os.openpty()          # real 120x32 terminal, TERM=xterm-256color
    p = subprocess.Popen(cmd, stdin=s, stdout=s, stderr=s, env=env)
    while time.time() - t0 < dur:
        r, _, _ = select.select([m], [], [], 0.2)
        if r:
            nbytes += len(os.read(m, 65536))   # bytes the TUI redraws
        # every 1 s: sum VmRSS and utime+stime from /proc for the tool tree
    return rss_avg, cpu_pct, first_frame, nbytes


# synthetic load the two TUIs have to keep up with
python3 -c 'x=0
while True: x+=1' &          # CPU spinner 1
python3 -c 'x=0
while True: x+=1' &          # CPU spinner 2
python3 -c 'import time; b=bytearray(160*1024*1024); time.sleep(120)' &
htop                         # observe, sample /proc, repeat

One debugging note from making this reproducible: the runner had no /dev/ptmx, so os.openpty() died with “out of pty devices” and both tools refused to draw. btop was blunter about it: “No tty detected!”. A mknod /dev/ptmx c 5 2 fixed it. If your container does the same, that is why your TUI benchmarks come back as zero.


The numbers

htop: {"rss_kb_avg": 6226, "cpu_pct": 3.32, "first_frame_s": 0.30, "pty_kbytes": 21.0}
btop: {"rss_kb_avg": 8160, "cpu_pct": 0.48, "first_frame_s": 0.03, "pty_kbytes": 83.0}

htop runs: 6125 KB / 3.24% / 0.306s, 6196 KB / 3.31% / 0.325s, 6356 KB / 3.40% / 0.275s
btop runs: 8193 KB / 0.51% / 0.036s, 8151 KB / 0.41% / 0.033s, 8136 KB / 0.52% / 0.035s
Bar chart of htop vs btop RSS, CPU and first frame results
Benchmark summary. Author’s own chart.
Metrichtop 3.4.1btop 1.4.6
Avg RSS under load6226 KB8160 KB
CPU while drawing3.32 %0.48 %
First frame0.30 s0.03 s
Terminal bytes redrawn per 10 s21 KB83 KB
Binary on disk0.4 MB1.7 MB
Mouse supportnonefull
Net and disk graphsplugins at bestbuilt in


The annoying bits

Both are more honest than the hype suggests. btop is four times more RAM and it repaints like it is being paid per byte: 83 KB of terminal traffic per 10 seconds means a sluggish SSH link pays for every animation, and on a 9600-baud console it will feel worse than htop. htop burned more CPU in my runs, 3.32 % against 0.48 %, because it recomputes the full table every refresh while btop pushes updates less often and lets the GPU-style charts age on screen. And htop still wants you to memorise function keys, while btop hides most cleverness behind a mouse you often do not have in SSH. Neither is broken; they fail differently.


Verdict

One winner per job: for low-bandwidth remote sessions htop wins, because 21 KB of redraw traffic over SSH on a jump host is half of what btop pushes, and 0.4 MB of binary fits the “carry it everywhere” idea. Choose btop when you are on a real workstation or a well-connected SSH session and want net, disk and process graphs in one screen without leaving the terminal; it also painted its first frame ten times faster, 0.03 s against 0.30 s, which matters when you SSH twenty times a day just to glance at something.


If you want the bigger sibling of this whole family, my takes on Zabbix agent versus Netdata and running Glances as a third option cover the non-TUI end of the spectrum, and df, du and ncdu is still my answer when the question is only about disk.


Next time a process table fights back, I will not guess. I will measure.

Mohamad ZulfahmyCybersecurity · OffSec · Entrepreneur
About me ↗
ON THIS PAGE
On this page