From d1d36a961aedbf706d05c1a1ee82a137b27963b8 Mon Sep 17 00:00:00 2001 From: Niklas Mohrin Date: Thu, 3 Jun 2021 19:14:16 +0200 Subject: [PATCH] Update README.md to include updated benchmark results --- README.md | 66 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 6059669..bd21ac3 100644 --- a/README.md +++ b/README.md @@ -31,38 +31,37 @@ High level project goals: - [x] Download and cache pages - [x] Don't require a network connection for anything besides updating the cache -- [x] Command line interface similar or equivalent to the [NodeJS client][tldr-node-client] +- [x] Command line interface similar or equivalent to the [NodeJS client][node-gh] +- [x] Comply with the [tldr client specification][client-spec] +- [x] Advanced highlighting and configuration - [x] Be fast -A tool like `tldr` should be as frictionless as possible to use. It should be -easy to invoke (just `tldr tar`, not using another subcommand like `tldr find -tar`) and it should show the output as fast as possible. +A tool like `tldr` should be as frictionless as possible to use and show the +output as fast as possible. -tealdeer reaches these goals. During a (highly non-scientific) test (see -[#38](https://github.com/dbrgn/tealdeer/issues/38) for details), I tested the -invocation speed of `tldr ` for a few of the existing clients: +We think that `tealdeer` reaches these goals. We put together a (more or less) +reproducible benchmark that compiles a handful of clients from source and +measures the execution times on a cold disk cache. The benchmarking is run in a +Docker container using sharkdp's [`hyperfine`][hyperfine-gh] +([Dockerfile][benchmark-dockerfile]). -| Client | Times (ms) | Avg of 5 (ms) | -| --- | --- | --- | -| [Tealdeer](https://github.com/dbrgn/tealdeer/) | `15/11/5/5/11` | `9.4` (100%) | -| [C client](https://github.com/tldr-pages/tldr-cpp-client) | `11/5/12/11/15` | `10.8` (115%) | -| [Bash client](https://github.com/pepa65/tldr-bash-client) | `15/19/22/25/24` | `21.0` (223%) | -| [Go client by k3mist](https://github.com/k3mist/tldr/) | `98/96/100/95/101` | `98.8` (1'051%) | -| [Python client](https://github.com/lord63/tldr.py) | `152/148/151/158/140` | `149.8` (1'594%) | -| [NodeJS client](https://github.com/tldr-pages/tldr-node-client) | `169/171/170/170/170` | `170.0` (1'809%) | - -tealdeer was the winner here, although the C client and the Bash client are in -the same speed class. Interpreted languages are clearly much slower to invoke, -a delay of 170 milliseconds is definitely noticeable and increases friction for -the user. - -These are the clients I tried but failed to compile or run: -[Haskell client](https://github.com/psibi/tldr-hs), -[Ruby client](https://github.com/YellowApple/tldrb), -[Perl client](https://github.com/skaji/perl-tldr), -[Go client by anoopengineer](https://github.com/anoopengineer/tldr/), -[PHP client](https://github.com/BrainMaestro/tldr-php). +| Client (50 runs, 29.07.2021) | Programming Language | Mean in ms | Deviation in ms | Comments | +| :---: | :---: | :---: | :---: | :---: | +| `tealdeer` | Rust | 16.2 | 1.2 | | +| [`tldr-c`][c-gh] | C | 35.7 | 3.2 | | +| [`tldr-hs`][hs-gh] | Haskell | 23.6 | 1.0 | no example highlighting | +| [`fast-tldr`][fast-tldr-gh] | Haskell | 15.2 | 0.7 | no example highlighting | +| [`tldr-bash`][bash-gh] | Bash | 28.3 | 1.1 | | +| [`tldr-python-client`][python-gh] | Python | 97.9 | 3.5 | | +| [`outfieldr`][outfieldr-gh] | Zig | 4.7 | 0.5 | no user configuration | +| [`tldr-node-client`][node-gh] | Javascript / Node | 533.1 | 12.5 | | +As you can see, `tealdeer` is not the fastest of the tested clients anymore. We +strive for useful features and code quality over raw performance, even if that +means that we don't come out on top in this friendly competition. That said, we +are still optimizing the code, for example when the `outfieldr` developers +[suggested to switch][outfieldr-comment-tls] to a native TLS implementation +instead of the native libraries. ## Development @@ -113,7 +112,18 @@ be dual licensed as above, without any additional terms or conditions. Thanks to @severen for coming up with the name "tealdeer"! -[tldr-node-client]: https://github.com/tldr-pages/tldr-node-client +[node-gh]: https://github.com/tldr-pages/tldr-node-client +[c-gh]: https://github.com/tldr-pages/tldr-c-client +[hs-gh]: https://github.com/psibi/tldr-hs +[fast-tldr-gh]: https://github.com/gutjuri/fast-tldr +[bash-gh]: https://4e4.win/tldr +[outfieldr-gh]: https://gitlab.com/ve-nt/outfieldr +[python-gh]: https://github.com/tldr-pages/tldr-python-client + +[benchmark-dockerfile]: https://github.com/dbrgn/tealdeer/blob/master/benchmarks/Dockerfile +[client-spec]: https://github.com/tldr-pages/tldr/blob/main/CLIENT-SPECIFICATION.md +[hyperfine-gh]: https://github.com/sharkdp/hyperfine +[outfieldr-comment-tls]: https://github.com/dbrgn/tealdeer/issues/129#issuecomment-833596765 [github-actions]: https://github.com/dbrgn/tealdeer/actions?query=branch%3Amaster