Skip to content

Phosphenius/yoctofetch

Repository files navigation

yoctofetch

REUSE status Made by Humans AUR License AUR package Guix packaged

Blazingly fast, ultra-lightweight system fetch tool.

Output of yoctofetch with the Arch Linux logo on a dark background Output of yoctofetch with the Guix System logo on a dark background Output of yoctofetch with the Guix System logo on a light background

Synopsis

Handcrafted on top of the Linux™ UAPI, independent of any libc, yoctofetch is a very fast and tiny system fetch tool. It currently has a stripped weight of about 20kb and runs in ~200μs (yes, microseconds).

Despite its incredible performance, it still supports quite a few features:

  • Logos (currently only Guix and Arch—more to come)
  • The majority of common system information
  • Customization via a configuration file
    • Disable output of specific system information
  • NO_COLOR support
  • Even man pages are included!

Supported platforms

Due to the freestanding C environment, the number of supported platforms is quite limited.

Currently the following are supported:

  • Linux ABI
    • x86_64
    • aarch64

Linux on arm (32bit) support might be added. It would also be nice to include the *BSDs, but they make it rather hard to write freestanding programs.

Installation

It can easily be installed on Guix with the following channel configuration:

      (channel
        (name 'yoctofetch)
        (url "https://codeberg.org/Phosphenius/yoctofetch.git")
        (branch "main")
        (introduction
          (make-channel-introduction
            "259077c4909205af495edd5b5dded5b1173f0217"
            (openpgp-fingerprint
              "E504 167C B345 F93E 11AE  341C 1CDA 78BC 7F6C F294"))))

The Arch Linux AUR offers a stable and a git variant:

Building from source is straightforward:

# git clone and cd to checkout
./configure
make

# optionally install
sudo make install

Customization

The configuration file (usually ~/.config/yoctofetch/yoctofetch.conf) can be used to en- or disable all available output options, given that configuration file support is enabled, which is the default, but can be changed via ./configure --disable-config-file when building for some extra performance.

Per default, all options are enabled—even if there is no configuration file (support).

Performance

The actual performance depends on multiple factors, such as how yoctofetch was built and the layout of the files on the system.

Build configuration

The recommended configuration for maximum performance is something like:

./configure CC=gcc  CFLAGS="-march=x86-64-v3 -O2 -flto" LDFLAGS="-Wl,--strip-all" --disable-config-file

At this point, it is uncertain if there is any benefit to -flto. One has to experiment with the flags a bit. On my system, this yields a binary 19K in size which runs in < 230µs.

Also, -march=x86_64-v3 will not work on older CPUs and might have to be replaced with -march=native or similar.

File layout

yoctofetch expects the data in files to be in a certain order or layout and can read them faster if the layout matches the expectations.

For the configuration file, this is usually under the control of the user and it is therefor recommended to keep the values in the configuration file in their default order.

This does not work for system files like /etc/os-release though. So performance will vary, even on the same hardware if a different Linux™ distro is installed.

Benchmarks

Run with hyperfine on a laptop with AMD Ryzen 7 5825U CPU.

Fetch Mean (µs) Min (μs) Max (μs) Relative
yoctofetch 217.6 ± 37.7 164.5 678.2 1
microfetch 884.4 ± 85.8 645.3 1431.9 4.06 ± 0.81
macchina 3100 ± 300 2600 4800 14.19 ± 2.77
uwufetch 16800 ± 600 16100 20200 77.42 ± 13.75
fastfetch 33400 ± 1500 30200 37400 153.71 ± 27.48
pfetch 89100 ± 2800 84500 96400 409.27 ± 72.11
ufetch 101200 ± 3700 98200 114500 464.91 ± 82.37
screenfetch 243900 ± 3100 24000 25000 1120.85 ± 194.94
neofetch 288200 ± 13800 270200 309100 1324.64 ± 238.35

Licensing

All code is provided under the terms of the GPL-3.0-or-later license.