Files
tty7/scripts/bench/mem.sh
l0ng-ai 22e1ab1694 tty7: a GPU-rendered, daemon-backed terminal in pure Rust
tty7 is split into two Rust processes: a persistent daemon that owns the
shells and a GPU-rendered client that talks to it over a local socket.
Because the shells live in the daemon, quitting and reopening the app
leaves the session intact — detach and reattach, no tmux required.

- Persistent sessions — the daemon holds the PTYs and child processes, so
  closing a window or swapping in a new build never takes a shell down.
- Performance — an 11 MB `cat` completes in 95 ms and DOOM-fire renders at
  888 fps; the daemon drains the PTY at device speed off the render path.
- Shell-aware — new tabs and splits open in the current working directory;
  zsh, bash, fish, and PowerShell are set up automatically.
- Enhanced prompt — inline completion, syntax highlighting, history, and
  in-terminal search, with rich flag/subcommand signatures for common tools.
- Tabs, resizable splits, a command palette, click-to-open links, desktop
  notifications, eight themes, and CJK/IME input.

Native builds for macOS, Windows, and Linux.
Built on Zed's gpui and Alacritty's VT core.
2026-07-06 21:54:27 +08:00

80 lines
2.0 KiB
Bash
Executable File

#!/bin/zsh
# Memory benchmark: cold-launch each terminal with its DEFAULT shell, idle 6 s
# at the prompt, record RSS via ps, kill, repeat. $1 = runs per terminal
# (default 3). tty7 is reported as GUI + daemon — both processes are part of
# delivering one window.
set -u
SELF=${0:A}
HERE=${SELF:h}
REPO=${HERE:h:h}
WORK=${TTY7_BENCH_DIR:-$REPO/.bench}
TTY7_BIN=${TTY7_BIN:-$REPO/target/release/tty7}
RUNS=${1:-3}
R=$WORK/results
mkdir -p $R
rss_kb() { ps -o rss= -p ${1:-0} 2>/dev/null | awk '{print $1+0}' }
out=$R/mem-tty7.txt
: > $out
for i in $(seq 1 $RUNS); do
cfg=$WORK/cfg-mem
rm -rf $cfg && mkdir -p $cfg && print -- '{}' > $cfg/config.json
$TTY7_BIN --config-dir $cfg >/dev/null 2>&1 &
gpid=$!
sleep 6
dpid=$(pgrep -f -- "--daemon --config-dir $cfg" | head -1)
g=$(rss_kb $gpid)
d=$(rss_kb ${dpid:-0})
print -- "run $i: gui ${g} KB, daemon ${d} KB, total $((g + d)) KB" >> $out
kill $gpid 2>/dev/null
[ -n "${dpid:-}" ] && kill $dpid 2>/dev/null
sleep 1
pkill -9 -f -- "$cfg" 2>/dev/null
sleep 1
done
print -- done >> $out
out=$R/mem-alacritty.txt
: > $out
for i in $(seq 1 $RUNS); do
: > $WORK/alacritty-empty.toml
/Applications/Alacritty.app/Contents/MacOS/alacritty --config-file $WORK/alacritty-empty.toml >/dev/null 2>&1 &
pid=$!
sleep 6
print -- "run $i: $(rss_kb $pid) KB" >> $out
kill $pid 2>/dev/null
sleep 2
done
print -- done >> $out
out=$R/mem-ghostty.txt
: > $out
for i in $(seq 1 $RUNS); do
/Applications/Ghostty.app/Contents/MacOS/ghostty --config-default-files=false >/dev/null 2>&1 &
pid=$!
sleep 6
print -- "run $i: $(rss_kb $pid) KB" >> $out
kill $pid 2>/dev/null
sleep 2
done
print -- done >> $out
out=$R/mem-kitty.txt
: > $out
for i in $(seq 1 $RUNS); do
/Applications/kitty.app/Contents/MacOS/kitty --config NONE >/dev/null 2>&1 &
pid=$!
sleep 6
print -- "run $i: $(rss_kb $pid) KB" >> $out
kill $pid 2>/dev/null
sleep 2
done
print -- done >> $out
echo "=== mem results ==="
for f in $R/mem-*.txt; do
echo "--- $f"
cat $f
done