index.md (2495B)
1 lowlatency 2 ========== 3 4 Summary 5 ------- 6 Trivial patch that reduces input/output latency by selectively disabling the 7 built in frame rate limiting for `KeyPress` events. 8 9 Description 10 ----------- 11 According to the popular essay 12 [Typing with pleasure](https://pavelfatin.com/typing-with-pleasure/) 13 by Pavel Fatin public available research data comes to the conclusion that 14 "Delay of visual feedback on a computer display have important effects on 15 typist behavior and satisfaction" and even though not necessarily consciously 16 perceived can have an significant impact on typing speed, error rate, eye and 17 muscle strain and the required amount of conscious attention. 18 19 Several publications \[[1](https://lwn.net/Articles/751763/)\],\[ 20 [2](https://danluu.com/term-latency/)\] that benchmarked latency metrics for 21 terminal emulators established that the latency performance of St is 22 consistently worse than that of XTerm or even that of Emacs eshell. 23 The reason for this is that st employs frame rate limiting configured by the 24 variable `xfps` in config.h in order to keep st from slowing down applications 25 with high output bandwidth. 26 27 This patch disables the frame rate limiting for events that are caused by 28 keyboard input but keeps it intact for all other events and consequently should 29 not harm throughput performance. 30 31 Benchmarks 32 ---------- 33 These benchmarks are done using generic `amdgpu` drivers on Linux with default 34 configuration on a 60Hz refresh rate display employing the utility 35 [Typometer](https://github.com/pavelfatin/typometer) to measure the latency. 36 37 [![Results Timeseries](xterm_vs_st0.8.3_vs_stlowlatency.png)](xterm_vs_st0.8.3_vs_stlowlatency.png) 38 39 [![Results Histogram](xterm_vs_stlowlatency_hist.png)](xterm_vs_stlowlatency_hist.png) 40 41 Throughput measured by time it takes to cat a 50MB file containing random data: 42 43 Terminal real user sys 44 -------------------------------------- 45 XTerm 7.853s 0.255s 0.819s 46 St 0.8.3 4.347s 0.246s 0.655s 47 St lowlatency 4.371s 0.254s 0.638s 48 49 **Conclusion**: The results show that the patch improves latency to the point 50 that it now beats previous leader XTerm without having impact on throughput. 51 52 Notes 53 ----- 54 * This patch will most probably show no effect if used in conjunction with a 55 compositor or any driver configuration that enforces global vsync. 56 57 * In rare cases you might experience tearing while typing. 58 59 Download 60 -------- 61 * [st-lowlatency-0.8.3.diff](st-lowlatency-0.8.3.diff) 62 63 Authors 64 ------- 65 * Matthias Schoth - <mschoth@gmail.com>