1# lsr
2
3`ls(1)` but with io_uring
4
5
6
7## Installation
8
9`lsr` uses the zig build system. To install, you will need zig 0.14.0. To
10install for the local user (assuming `$HOME/.local/bin` is in `$PATH`), run:
11
12```sh
13zig build -Doptimize=ReleaseSmall --prefix $HOME/.local
14```
15
16which will install `lsr` and the associated manpage appropriately. Replace
17`$HOME/.local` with your preferred installation directory.
18
19## Usage
20
21```
22lsr [options] [path]
23
24 --help Print this message and exit
25 --version Print the version string
26
27DISPLAY OPTIONS
28 -1, --oneline Print entries one per line
29 -a, --all Show files that start with a dot (ASCII 0x2E)
30 -A, --almost-all Like --all, but skips implicit "." and ".." directories
31 -C, --columns Print the output in columns
32 --color=WHEN When to use colors (always, auto, never)
33 --group-directories-first Print all directories before printing regular files
34 --hyperlinks=WHEN When to use OSC 8 hyperlinks (always, auto, never)
35 --icons=WHEN When to display icons (always, auto, never)
36 -l, --long Display extended file metadata
37 -r, --reverse Reverse the sort order
38 -t, --time Sort the entries by modification time, most recent first
39
40```
41
42## Benchmarks
43
44Benchmarks were all gathered on the same set of directories, using the latest
45releases of each program (versions are shown below). All benchmarks run on Linux
46(because io_uring). `lsr` does work on macOS/BSD as well, but will not see the
47syscall batching benefits that are available with io_uring.
48
49| Program | Version |
50|:--------:|:-------:|
51| lsr | 0.1.0 |
52| ls | 9.7 |
53| eza | 0.21.3 |
54| lsd | 1.1.5 |
55| uutils | 0.0.30 |
56| busybox | 1.36.1 |
57
58### Time
59
60Data gathered with `hyperfine` on a directory of `n` plain files.
61
62| Program | n=10 | n=100 | n=1,000 | n=10,000 |
63|:--------------:|:--------:|:--------:|:-------:|:--------:|
64| lsr -al | 372.6 µs | 634.3 µs | 2.7 ms | 22.1 ms |
65| busybox ls -al | 403.8 µs | 1.1 ms | 3.5 ms | 32.5 ms |
66| ls -al | 1.4 ms | 1.7 ms | 4.7 ms | 38.0 ms |
67| eza -al | 2.9 ms | 3.3 ms | 6.6 ms | 40.2 ms |
68| lsd -al | 2.1 ms | 3.5 ms | 17.0 ms | 153.4 ms |
69| uutils ls -al | 2.9 ms | 3.6 ms | 11.3 ms | 89.6 ms |
70
71### Syscalls
72
73Data gathered with `strace -c` on a directory of `n` plain files. (Lower is better)
74
75| Program | n=10 | n=100 | n=1,000 | n=10,000 |
76|:--------------:|:----:|:-----:|:-------:|:--------:|
77| lsr -al | 20 | 28 | 105 | 848 |
78| busybox ls -al | 84 | 410 | 2,128 | 20,383 |
79| ls -al | 405 | 675 | 3,377 | 30,396 |
80| eza -al | 319 | 411 | 1,320 | 10,364 |
81| lsd -al | 508 | 1,408 | 10,423 | 100,512 |
82| uutils ls -al | 445 | 986 | 6,397 | 10,005 |