Files
hyprland-headless-stream-pl…/spikes/capture-speed/run-final.sh
T
Hermenix 36efa316fd spike: the verdict, the table, the chart -- in-process pywayland wins on zwlr-screencopy
Four routes measured on one frozen contract at one session's container size, with
RAM and CPU as first-class results: in-process pywayland is ~1.5x faster (78 vs
117 ms), uses ~2.8x less of our own CPU, and nearly halves the compositor's
per-frame CPU (67 vs 116 ms). grim-rs buys nothing and costs 746 MB RSS.
ext-image-copy-capture measures identical to screencopy and appears in a
compositor crash stack, so the deprecated-but-working protocol is the pick.

Also fixes the client's unclean exit (pywayland teardown segfaulted after the
result was printed, 16 times, one batch coinciding with a compositor crash).
2026-10-11 17:08:13 +00:00

51 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# The decision-relevant matrix: one session's container (1280x720) per pass, one
# session at a time.
#
# Why it is narrower than the first attempt: the `--all` cells changed meaning
# whenever a second session existed (2560x720 became 3840x720), and running two
# sessions plus four routes on a two-core software-rendered box twice crashed the
# compositor mid-run. The wire-relevant case for live streaming and agent eyes is
# one session's window, so that is what this measures -- and it runs the sessions
# sequentially to keep the load off the compositor.
set -u
cd "$(dirname "$0")"
start_session() {
local page="$1" profile="$2"
hhstream session start chromium --idle-timeout 3h --wait-ready 45s -- \
--ozone-platform=wayland --no-first-run --no-default-browser-check \
--user-data-dir="/var/lib/hermes/hhstream-sessions/$profile" \
--window-size=1280,720 "--app=$page" >/dev/null 2>&1
sleep 6
hhstream session list --json 2>/dev/null | python3 -c "
import json,sys
d=json.load(sys.stdin)
s=d['sessions'][-1]
print(s['container']['output'])"
}
echo "########## PASS A: moving screen ##########"
A=$(start_session "http://127.0.0.1/spin.html" chromium-bench-fin)
echo "target: $A"
if [ -n "$A" ]; then
nix-shell shell.nix --run "python3 bench.py --output $A --cells output-raw --cells output-jpeg \
--frames 200 --warmup 10 --runs 2 --control-seconds 10 --resume --results results/final-motion"
hhstream session kill "$(hhstream session list --json | python3 -c 'import json,sys;print(json.load(sys.stdin)[\"sessions\"][-1][\"id\"])')" >/dev/null 2>&1
else
echo "no session: compositor may be down"
fi
echo "########## PASS B: still screen ##########"
B=$(start_session "http://127.0.0.1/static.html" chromium-bench-still)
echo "target: $B"
if [ -n "$B" ]; then
nix-shell shell.nix --run "python3 bench.py --output $B --cells output-raw --cells output-jpeg \
--frames 200 --warmup 10 --runs 2 --control-seconds 10 --resume --results results/final-still"
fi
echo "########## compositor survived? ##########"
systemctl is-active hyprland-headless.service
journalctl --since "30 minutes ago" --no-pager 2>/dev/null | grep -c "dumped core" | sed 's/^/core dumps in the last 30 min: /'
echo "########## final matrix complete ##########"