[wiki] [sites] [st][patch][lowlatency] Introducing new patch for st called lowlatency. || Matthias Schoth

From: <git_AT_suckless.org>
Date: Mon, 25 May 2020 04:00:59 +0200

commit 87fac66fea613a7e8d798da65dcd3552d4766817
Author: Matthias Schoth <mschoth_AT_gmail.com>
Date: Mon May 25 04:00:09 2020 +0200

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

diff --git a/st.suckless.org/patches/lowlatency/index.md b/st.suckless.org/patches/lowlatency/index.md
new file mode 100644
index 00000000..1caec243
--- /dev/null
+++ b/st.suckless.org/patches/lowlatency/index.md
_AT_@ -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_AT_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
new file mode 100644
index 00000000..50e634d4
--- /dev/null
+++ b/st.suckless.org/patches/lowlatency/st-lowlatency-0.8.3.diff
_AT_@ -0,0 +1,26 @@
+From 6d7aa31dfde1bd38aa65ef4434930a9fa5b0b5e1 Mon Sep 17 00:00:00 2001
+From: Matthias Schoth <mschoth_AT_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
+_AT_@ -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
new file mode 100644
index 00000000..45b50122
Binary files /dev/null and b/st.suckless.org/patches/lowlatency/xterm_vs_st0.8.3_vs_stlowlatency.png 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
new file mode 100644
index 00000000..6e426a83
Binary files /dev/null and b/st.suckless.org/patches/lowlatency/xterm_vs_stlowlatency_hist.png differ
Received on Mon May 25 2020 - 04:00:59 CEST

This archive was generated by hypermail 2.3.0 : Mon May 25 2020 - 04:12:48 CEST