sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 87fac66fea613a7e8d798da65dcd3552d4766817
parent 844b7d49d656dd1c3e3abb8108b27c609f16535e
Author: Matthias Schoth <mschoth@gmail.com>
Date:   Mon, 25 May 2020 04:00:09 +0200

[st][patch][lowlatency] Introducing new patch for st called lowlatency.

Diffstat:
Ast.suckless.org/patches/lowlatency/index.md | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ast.suckless.org/patches/lowlatency/st-lowlatency-0.8.3.diff | 26++++++++++++++++++++++++++
Ast.suckless.org/patches/lowlatency/xterm_vs_st0.8.3_vs_stlowlatency.png | 0
Ast.suckless.org/patches/lowlatency/xterm_vs_stlowlatency_hist.png | 0
4 files changed, 91 insertions(+), 0 deletions(-)

diff --git a/st.suckless.org/patches/lowlatency/index.md b/st.suckless.org/patches/lowlatency/index.md @@ -0,0 +1,65 @@ +lowlatency +========== + +Summary +------- +Trivial patch that reduces input/output latency by selectively disabling the +built in frame rate limiting for `KeyPress` events. + +Description +----------- +According to the popular essay +[Typing with pleasure](https://pavelfatin.com/typing-with-pleasure/) +by Pavel Fatin public available research data comes to the conclusion that +"Delay of visual feedback on a computer display have important effects on +typist behavior and satisfaction" and even though not necessarily consciously +perceived can have an significant impact on typing speed, error rate, eye and +muscle strain and the required amount of conscious attention. + +Several publications \[[1](https://lwn.net/Articles/751763/)\],\[ +[2](https://danluu.com/term-latency/)\] that benchmarked latency metrics for +terminal emulators established that the latency performance of St is +consistently worse than that of XTerm or even that of Emacs eshell. +The reason for this is that st employs frame rate limiting configured by the +variable `xfps` in config.h in order to keep st from slowing down applications +with high output bandwidth. + +This patch disables the frame rate limiting for events that are caused by +keyboard input but keeps it intact for all other events and consequently should +not harm throughput performance. + +Benchmarks +---------- +These benchmarks are done using generic `amdgpu` drivers on Linux with default +configuration on a 60Hz refresh rate display employing the utility +[Typometer](https://github.com/pavelfatin/typometer) to measure the latency. + +[![Results Timeseries](xterm_vs_st0.8.3_vs_stlowlatency.png)](xterm_vs_st0.8.3_vs_stlowlatency.png) + +[![Results Histogram](xterm_vs_stlowlatency_hist.png)](xterm_vs_stlowlatency_hist.png) + +Throughput measured by time it takes to cat a 50MB file containing random data: + + Terminal real user sys + -------------------------------------- + XTerm 7.853s 0.255s 0.819s + St 0.8.3 4.347s 0.246s 0.655s + St lowlatency 4.371s 0.254s 0.638s + +**Conclusion**: The results show that the patch improves latency to the point +that it now beats previous leader XTerm without having impact on throughput. + +Notes +----- +* This patch will most probably show no effect if used in conjunction with a +compositor or any driver configuration that enforces global vsync. + +* In rare cases you might experience tearing while typing. + +Download +-------- +* [st-lowlatency-0.8.3.diff](st-lowlatency-0.8.3.diff) + +Authors +------- +* Matthias Schoth - <mschoth@gmail.com> diff --git a/st.suckless.org/patches/lowlatency/st-lowlatency-0.8.3.diff b/st.suckless.org/patches/lowlatency/st-lowlatency-0.8.3.diff @@ -0,0 +1,26 @@ +From 6d7aa31dfde1bd38aa65ef4434930a9fa5b0b5e1 Mon Sep 17 00:00:00 2001 +From: Matthias Schoth <mschoth@gmail.com> +Date: Mon, 25 May 2020 02:30:41 +0200 +Subject: [PATCH] Trivial patch that reduces input/output latency by + selectively disabling the built in frame rate limiting for KeyPress events. + +--- + x.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/x.c b/x.c +index e5f1737..f6b7604 100644 +--- a/x.c ++++ b/x.c +@@ -1933,6 +1933,8 @@ run(void) + dodraw = 1; + last = now; + } ++ if (ev.type == KeyPress) ++ dodraw = 1; + + if (dodraw) { + while (XPending(xw.dpy)) { +-- +2.26.2 + diff --git a/st.suckless.org/patches/lowlatency/xterm_vs_st0.8.3_vs_stlowlatency.png b/st.suckless.org/patches/lowlatency/xterm_vs_st0.8.3_vs_stlowlatency.png Binary files differ. diff --git a/st.suckless.org/patches/lowlatency/xterm_vs_stlowlatency_hist.png b/st.suckless.org/patches/lowlatency/xterm_vs_stlowlatency_hist.png Binary files differ.