Skip to content

Performance

leo-arch edited this page Aug 7, 2024 · 74 revisions

Table of contents

1) Statistics

All the following tests were executed on exactly the same system using clifm 1.14.

a) Memory usage

Data retrieved via htop

Application Resident (3,549 files) Resident (100,000 files)
ranger 43384k 542M
rnr 71828k --fails--
lf 22608k 103M
xplr 13484k 149M
yazi 14504K 45M
mc 12204k 35M
broot 11960k --fails--
vifm 9816k 101M
clex 7368k 78M
joshuto 7512k 38M
fff 6366k 79M
clifm 6252k 24M
nnn 4040k 10M
cfiles 3796k --fails--

b) Disk usage

Data retrieved via: du

b.1) Binary size

Binary Size
/usr/bin/broot 10316k
/usr/bin/yazi 8176K
/usr/bin/xplr 5044k
/usr/bin/joshuto 4420k
/usr/bin/lf 3864k
/usr/bin/vifm 1560k
/usr/bin/mc 1260k
/usr/bin/clifm 920k1
/usr/bin/pilot 736k
/usr/bin/clex 420k
/usr/bin/nnn 120k
/usr/bin/cfiles 44k

1 If compressed via upx(1) we get a much smaller binary size: 404k.

b.2) Package size

Data retrieved via pacman -Qi

Package Installed size
broot 10.71 MiB
yazi 7.99 MiB
mc 7.03 MiB
joshuto 4.68MiB
lf 4.30 MiB
xplr 5.21MiB
vifm 2.84 MiB
ranger 2.64 MiB
clifm 1.30 MiB
clex 439.20 KiB
rnr 633.29 KiB
nnn 346.41 KiB
cfiles 45.43 KiB
fff 45.39 KiB

c) Performance

c.1) SysCalls (listing 3,549 files)

Data retrieved using strace -c

Application Syscalls
cfiles 113,079
joshuto 90,592
lsd 65,607
xplr 30,955
rnr 15,782
fff 11,895
ranger 10,461
clifm 9,7131
mc 9,194
clex 8,403
exa 5,645
broot 5,088
nnn 3,786
clifm (light) 1,508
ls 964
lf 322

1 A third of these syscalls are used to check files for capabilities. If you don't need this check, you can run with --no-file-cap (note that on non-Linux systems this check is never performed).

c.2) Listing time: clifm vs ls(1) (listing 100,000 files)

Note that the clifm commands below attempt to replicate the corresponding ls output, focusing only on listing speed (which is why we disable some clifm-specific features: config files (-S), external commands (-x), ELN's (-e), file capabilities and extension checks (--no-file-cap, --no-file-ext), and names trimming (--no-trim-names)).

These tests have been performed using time(1) with the -p option.

a. Normal mode

clifm -Sxe --list-and-quit --no-file-cap --no-file-ext --no-trim-names:

real 0.94
user 0.26
sys 0.31

ls --color=always:

real 0.93
user 0.36
sys 0.34

b. Long/detail mode

clifm -LSxe --list-and-quit --no-file-cap --no-file-ext --no-trim-names --no-color:

real 1.98
user 0.73
sys 0.75

ls -l:

real 2.02
user 0.67
sys 0.83

As you can see, clifm performs quite well on each of the testing fields, positioning itself overall among the most performant terminal file managers for Unix systems.

2) Optimization

Getting some extra performance

As you can see, clifm is by itself quite fast by default. But if speed is still an issue, it is possible to get some extra performance:

1. Disable the files counter, used to print the amount of files contained by listed directories. Disabling this option produces a nice performance boost.1

2. Disable some features: icons (if enabled), columns, sorted files, directories first, files capabilities check, files extension check, symlinks resolution, Unicode, colors, and, if already running without colors, file type indicators (classification):

clifm --no-colors --no-columns --no-classify --no-files-counter --no-unicode --no-dirs-first --sort=0 --no-file-cap --no-file-ext --no-follow-symlink

3. Run in light mode

4. Limit listed files. Because listing lots of files could be expensive and time consuming, you can also try to limit the amount of files printed for each visited directory (see the mf command).

5. Run in stealth mode

6. Compile in/out a few features:

a) Compile with `-D_TOURBIN_QSORT` to use Alexey Tourbin faster qsort implementation instead of **qsort(3)**. \
b) Compile out features you don't need to get a bit smaller, and thereby faster, executable. For example, to compile out icons and translation support:
clang ... -D_TOURBIN_QSORT -D_NO_GETTEXT -D_NO_ICONS ...

For more information consult the compiling features in/out section.

1 Disable the files counter either via the --no-files-counter command line option, the FilesCounter option in the configuration file or the fc command.

Clifm and terminal emulators

Despite the above, however, it is important to bear in mind that listing speed does not only depend on the program's code and enabled features, but also on the terminal's rendering speed.1 Old, basic terminal emulators like Xterm, Aterm, and the kernel built-in console are quite slow compared to more modern ones like Urxvt, Lxterminal, ST, or Alacritty, to name just a few.2

1 On this topic, see this excellent article written by Anarcat. See also https://stackoverflow.com/questions/3857052/why-is-printing-to-stdout-so-slow-can-it-be-sped-up.

2 If using Xterm, setting the fastScroll resource to true in your ~/.Xresources file produces a quite decent performance boost in terms of rendering speed: XTerm*fastScroll: true. Even thus, nonetheless, it is far behind modern terminal emulators, specially when it comes to large directories.

Clone this wiki locally