From a4b1c09d582d1efda123bee7c96cd571bc2cc32d Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 31 May 2020 12:43:03 +0200 Subject: scripts: benchmarking utility script --- scripts/benchmark.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 scripts/benchmark.py diff --git a/scripts/benchmark.py b/scripts/benchmark.py new file mode 100755 index 00000000..5483dac1 --- /dev/null +++ b/scripts/benchmark.py @@ -0,0 +1,51 @@ +#!/usr/bin/env -S python3 -u + +import argparse +import fcntl +import os +import statistics +import struct +import sys +import termios + +from datetime import datetime + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('files', type=argparse.FileType('rb'), nargs='+') + parser.add_argument('--iterations', type=int, default=20) + + args = parser.parse_args() + + lines, cols, height, width = struct.unpack( + 'HHHH', + fcntl.ioctl(sys.stdout.fileno(), + termios.TIOCGWINSZ, + struct.pack('HHHH', 0, 0, 0, 0))) + + times = {name: [] for name in [f.name for f in args.files]} + + for f in args.files: + bench_bytes = f.read() + + for i in range(args.iterations): + start = datetime.now() + sys.stdout.buffer.write(bench_bytes) + stop = datetime.now() + + times[f.name].append((stop - start).total_seconds()) + + del bench_bytes + + print('\033[J') + print(times) + print(f'cols={cols}, lines={lines}, width={width}px, height={height}px') + for f in args.files: + print(f'{os.path.basename(f.name)}: ' + f'{statistics.mean(times[f.name]):.3f}s ' + f'±{statistics.stdev(times[f.name]):.3f}') + + +if __name__ == '__main__': + sys.exit(main()) -- cgit v1.3 From dd05b14c475b986ff6696a7f896ca3c44c47eb23 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 31 May 2020 13:07:01 +0200 Subject: benchmarks: initial results --- README.md | 2 +- doc/benchmark.md | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 doc/benchmark.md diff --git a/README.md b/README.md index f52db413..1e1ce281 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The fast, lightweight and minimalistic Wayland terminal emulator. ## Features -* Fast +* Fast (see [benchmarks](doc/benchmarks.md)) * Lightweight, in dependencies, on-disk and in-memory * Wayland native * DE agnostic diff --git a/doc/benchmark.md b/doc/benchmark.md new file mode 100644 index 00000000..0e42f798 --- /dev/null +++ b/doc/benchmark.md @@ -0,0 +1,41 @@ +# Benchmarks + +## vtebench + +All benchmarks are done using [vtebench](https://github.com/alacritty/vtebench): + +vtebench -h $(tput lines) -w $(tput cols) -b 104857600 alt-screen-random-write > ~/alt-random +vtebench -c -h $(tput lines) -w $(tput cols) -b 104857600 alt-screen-random-write > ~/alt-random-colors +vtebench -h $(tput lines) -w $(tput cols) -b 10485760 scrolling > ~/scrolling +vtebench -h $(tput lines) -w $(tput cols) -b 104857600 scrolling --fill-lines > ~/scrolling-filled-lines +vtebench -h $(tput lines) -w $(tput cols) -b 10485760 unicode-random-write > ~/unicode-random + +They were "executed" using [benchmark.py](../scripts/benchmark.py), +which will load each file into memory, and then print it to the +terminal. This is done **20** times for each test. Then it calculates +the _mean_ and _standard deviation_ for each test. + + +## 2020-05-31 + +### System + +CPU: i5-8250U +RAM: 8GB RAM +Graphics: Intel UHD Graphcis 620 + + +### Terminal configuration + +Geometry: 953x1023 +Font: Dina:pixelsize=12 +scrollback=10000 + + +| Benchmark | Foot (GCC+PGO) | Alacritty | URxvt | St | XTerm | +|------------------------|----------------|---------------|⨪---------------|---------------|---------------| +| alt-random | 0.791s ±0.080 | 1.558s ±0.038 | 1.746s ±0.065 | 2.628s ±0.085 | 1.706s ±0.064 | +| alt-random-colors | 0.830s ±0.076 | 1.587s ±0.041 | 2.049s ±0.118 | 3.033s ±0.129 | 2.109s ±0.131 | +| scrolling | 1.603s ±0.070 | 1.464s ±0.098 | 1.439s ±0.035 | 3.760s ±0.113 | 1.459s ±0.036 | +| scrolling-filled-lines | 1.888s ±0.021 | 2.334s ±0.078 | 2.145s ±0.074 | 3.372s ±0.078 | 2.144s ±0.091 | +| unicode-random | 1.545s ±0.229 | 0.164s ±0.012 | 11.180s ±0.342 | crashed |11.389s ±0.269 | -- cgit v1.3 From 6b2a59110d0bfe54545ce94b4500db4505d183c9 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 31 May 2020 13:07:53 +0200 Subject: readme: fix benchmark link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1e1ce281..d4605871 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The fast, lightweight and minimalistic Wayland terminal emulator. ## Features -* Fast (see [benchmarks](doc/benchmarks.md)) +* Fast (see [benchmarks](doc/benchmark.md)) * Lightweight, in dependencies, on-disk and in-memory * Wayland native * DE agnostic -- cgit v1.3 From 09d10b6a486c9a2b5e27be344e5ac0db86ccdd01 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 31 May 2020 13:08:19 +0200 Subject: doc: benchmarks: shell highlighting of vtebench commands --- doc/benchmark.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/benchmark.md b/doc/benchmark.md index 0e42f798..61988c50 100644 --- a/doc/benchmark.md +++ b/doc/benchmark.md @@ -4,11 +4,13 @@ All benchmarks are done using [vtebench](https://github.com/alacritty/vtebench): +```sh vtebench -h $(tput lines) -w $(tput cols) -b 104857600 alt-screen-random-write > ~/alt-random vtebench -c -h $(tput lines) -w $(tput cols) -b 104857600 alt-screen-random-write > ~/alt-random-colors vtebench -h $(tput lines) -w $(tput cols) -b 10485760 scrolling > ~/scrolling vtebench -h $(tput lines) -w $(tput cols) -b 104857600 scrolling --fill-lines > ~/scrolling-filled-lines vtebench -h $(tput lines) -w $(tput cols) -b 10485760 unicode-random-write > ~/unicode-random +``` They were "executed" using [benchmark.py](../scripts/benchmark.py), which will load each file into memory, and then print it to the -- cgit v1.3 From ee4b4b86467e85b47734ef2ac4e132c9c7e1a7ae Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 31 May 2020 13:08:44 +0200 Subject: doc: benchmark: newlines (?) --- doc/benchmark.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/benchmark.md b/doc/benchmark.md index 61988c50..940cfc20 100644 --- a/doc/benchmark.md +++ b/doc/benchmark.md @@ -22,8 +22,8 @@ the _mean_ and _standard deviation_ for each test. ### System -CPU: i5-8250U -RAM: 8GB RAM +CPU: i5-8250U +RAM: 8GB RAM Graphics: Intel UHD Graphcis 620 -- cgit v1.3 From 04013a2480c33d506bc862ab6f95c8d3310c3a05 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 31 May 2020 13:09:03 +0200 Subject: doc: benchmark: newlines --- doc/benchmark.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/benchmark.md b/doc/benchmark.md index 940cfc20..0e9c337d 100644 --- a/doc/benchmark.md +++ b/doc/benchmark.md @@ -22,8 +22,10 @@ the _mean_ and _standard deviation_ for each test. ### System -CPU: i5-8250U -RAM: 8GB RAM +CPU: i5-8250U + +RAM: 8GB RAM + Graphics: Intel UHD Graphcis 620 -- cgit v1.3 From 05a6a9de44a003ba41b3bdbf8be3cc6ca632aa1b Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 31 May 2020 13:11:19 +0200 Subject: doc: benchmark: fix typo --- doc/benchmark.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/benchmark.md b/doc/benchmark.md index 0e9c337d..bfabcb0f 100644 --- a/doc/benchmark.md +++ b/doc/benchmark.md @@ -37,7 +37,7 @@ scrollback=10000 | Benchmark | Foot (GCC+PGO) | Alacritty | URxvt | St | XTerm | -|------------------------|----------------|---------------|⨪---------------|---------------|---------------| +|------------------------|----------------|---------------|----------------|---------------|---------------| | alt-random | 0.791s ±0.080 | 1.558s ±0.038 | 1.746s ±0.065 | 2.628s ±0.085 | 1.706s ±0.064 | | alt-random-colors | 0.830s ±0.076 | 1.587s ±0.041 | 2.049s ±0.118 | 3.033s ±0.129 | 2.109s ±0.131 | | scrolling | 1.603s ±0.070 | 1.464s ±0.098 | 1.439s ±0.035 | 3.760s ±0.113 | 1.459s ±0.036 | -- cgit v1.3 From ded6ca6f22a9564d2a6c94549e07f72a74197917 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 31 May 2020 13:13:12 +0200 Subject: doc: benchmark: right-align columns --- doc/benchmark.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/benchmark.md b/doc/benchmark.md index bfabcb0f..f736187f 100644 --- a/doc/benchmark.md +++ b/doc/benchmark.md @@ -32,12 +32,14 @@ Graphics: Intel UHD Graphcis 620 ### Terminal configuration Geometry: 953x1023 + Font: Dina:pixelsize=12 + scrollback=10000 | Benchmark | Foot (GCC+PGO) | Alacritty | URxvt | St | XTerm | -|------------------------|----------------|---------------|----------------|---------------|---------------| +|------------------------|---------------:|--------------:|---------------:|--------------:|--------------:| | alt-random | 0.791s ±0.080 | 1.558s ±0.038 | 1.746s ±0.065 | 2.628s ±0.085 | 1.706s ±0.064 | | alt-random-colors | 0.830s ±0.076 | 1.587s ±0.041 | 2.049s ±0.118 | 3.033s ±0.129 | 2.109s ±0.131 | | scrolling | 1.603s ±0.070 | 1.464s ±0.098 | 1.439s ±0.035 | 3.760s ±0.113 | 1.459s ±0.036 | -- cgit v1.3