mirror of
https://github.com/NotAShelf/microfetch.git
synced 2026-02-03 10:05:51 +00:00
Compare commits
6 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2ae1a9af7 |
||
|
40b10d8bbe |
|||
|
|
b656de287e |
||
|
3de8b5ef8e |
|||
|
303c09e513 |
|||
|
d08ad6e38e |
6 changed files with 330 additions and 291 deletions
BIN
.github/assets/demo.png
vendored
BIN
.github/assets/demo.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
8
Cargo.lock
generated
8
Cargo.lock
generated
|
|
@ -441,9 +441,9 @@ checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hotpath"
|
name = "hotpath"
|
||||||
version = "0.9.2"
|
version = "0.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d8d5a16b6aedd67d44fbeb619e63d9fa649d77cabb25a4154f87deec8eeaff4a"
|
checksum = "3554f9fc054c95f68e9f31196ca3aa77c6ce299f2e5877788e68168d01b7cfab"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arc-swap",
|
"arc-swap",
|
||||||
"base64",
|
"base64",
|
||||||
|
|
@ -540,9 +540,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.179"
|
version = "0.2.180"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c5a2d376baa530d1238d133232d15e239abad80d05838b4b59354e5268af431f"
|
checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libredox"
|
name = "libredox"
|
||||||
|
|
|
||||||
16
Cargo.toml
16
Cargo.toml
|
|
@ -1,7 +1,13 @@
|
||||||
[package]
|
[package]
|
||||||
name = "microfetch"
|
name = "microfetch"
|
||||||
version = "0.4.13"
|
description = "Microscopic fetch tool in Rust, for NixOS systems, with special emphasis on speed"
|
||||||
edition = "2024"
|
version = "0.4.13"
|
||||||
|
edition = "2024"
|
||||||
|
authors = [ "NotAShelf <raf@notashelf.dev>" ]
|
||||||
|
rust-version = "1.90"
|
||||||
|
readme = "./docs/README.md"
|
||||||
|
repository = "https://github.com/notashelf/microfetch"
|
||||||
|
license = "GPL-3.0"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "microfetch_lib"
|
name = "microfetch_lib"
|
||||||
|
|
@ -12,8 +18,8 @@ name = "microfetch"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
hotpath = { optional = true, version = "0.9.2" }
|
hotpath = { optional = true, version = "0.9.3" }
|
||||||
libc = "0.2.179"
|
libc = "0.2.180"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.8.1"
|
criterion = "0.8.1"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
<p>Microscopic fetch tool in Rust, for NixOS systems, with special emphasis on speed</p>
|
<p>Microscopic fetch tool in Rust, for NixOS systems, with special emphasis on speed</p>
|
||||||
<br/>
|
<br/>
|
||||||
<a href="#synopsis">Synopsis</a><br/>
|
<a href="#synopsis">Synopsis</a><br/>
|
||||||
<a href="#features">Features</a> | <a href="#motivation">Motivation</a><br/> | <a href="#benchmarks">Benchmarks</a><br/>
|
<a href="#features">Features</a> | <a href="#motivation">Motivation</a> | <a href="#benchmarks">Benchmarks</a><br/>
|
||||||
<a href="#installation">Installation</a>
|
<a href="#installation">Installation</a>
|
||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -27,11 +27,13 @@ communities. Aims to replace [fastfetch] on my personal system, but
|
||||||
on your system: it is pretty _[fast](#benchmarks)_...
|
on your system: it is pretty _[fast](#benchmarks)_...
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
<br/>
|
||||||
<img
|
<img
|
||||||
alt="latest demo"
|
alt="latest demo"
|
||||||
src="./.github/assets/demo.png"
|
src="./assets/demo.png"
|
||||||
width="850px"
|
width="800px"
|
||||||
>
|
>
|
||||||
|
<br/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
@ -55,10 +57,14 @@ on your system: it is pretty _[fast](#benchmarks)_...
|
||||||
- Shell Colors
|
- Shell Colors
|
||||||
- Did I mention fast?
|
- Did I mention fast?
|
||||||
- Respects [`NO_COLOR` spec](https://no-color.org/)
|
- Respects [`NO_COLOR` spec](https://no-color.org/)
|
||||||
|
- Funny [^2]
|
||||||
|
|
||||||
[^1]: With the Mold linker, which is enabled by default in the Flake package,
|
[^1]: With the Mold linker, which is enabled by default in the Flake package,
|
||||||
the binary size is roughly 350kb. That's nearly 20kb reduction in size :)
|
the binary size is roughly 350kb. That's nearly 20kb reduction in size :)
|
||||||
|
|
||||||
|
[^2]: I don't know how else to describe the (unhealthy) amount of handwritten
|
||||||
|
assembly that was written in order to make Microfetch faster.
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
|
|
||||||
[Rube-Goldmark Machine]: https://en.wikipedia.org/wiki/Rube_Goldberg_machine
|
[Rube-Goldmark Machine]: https://en.wikipedia.org/wiki/Rube_Goldberg_machine
|
||||||
|
|
@ -87,14 +93,15 @@ solve a technical problem. The "problem" Microfetch solves is entirely
|
||||||
self-imposed. On the matter of _size_, the project is written in Rust, which
|
self-imposed. On the matter of _size_, the project is written in Rust, which
|
||||||
comes at the cost of "bloated" dependency trees and the increased build times,
|
comes at the cost of "bloated" dependency trees and the increased build times,
|
||||||
but we make an extended effort to keep the dependencies minimal and build times
|
but we make an extended effort to keep the dependencies minimal and build times
|
||||||
managable. The latter is also very easily mitigated with Nix's binary cache
|
manageable. The latter is also very easily mitigated with Nix's binary cache
|
||||||
systems. Since Microfetch is already in Nixpkgs, you are recommended to use it
|
systems. Since Microfetch is already in Nixpkgs, you are recommended to use it
|
||||||
to utilize the binary cache properly. The usage of Rust _is_ nice, however,
|
to utilize the binary cache properly. The usage of Rust _is_ nice, however,
|
||||||
since it provides us with incredible tooling and a very powerful language that
|
since it provides us with incredible tooling and a very powerful language that
|
||||||
allows for Microfetch to be as fast as possible. ~~Sure C could've been used
|
allows for Microfetch to be as fast as possible. ~~Sure C could've been used
|
||||||
here as well, but do you think I hate myself?~~ Microfetch now features
|
here as well, but do you think I hate myself?~~ Microfetch now features
|
||||||
handwritten assembly to unsafely optimize some areas. In hindsight you all
|
handwritten assembly to unsafely optimize some areas. In hindsight you all
|
||||||
should have seen this coming. Is it faster? Yes.
|
should have seen this coming. Is it faster? Yes. Should you use this? If you
|
||||||
|
want to.
|
||||||
|
|
||||||
Also see: [Rube-Goldmark Machine]
|
Also see: [Rube-Goldmark Machine]
|
||||||
|
|
||||||
|
|
@ -128,9 +135,19 @@ up to date, but I will try to update the numbers as I make Microfetch faster.
|
||||||
|
|
||||||
The point stands that Microfetch is significantly faster than every other fetch
|
The point stands that Microfetch is significantly faster than every other fetch
|
||||||
tool I have tried. This is to be expected, of course, since Microfetch is
|
tool I have tried. This is to be expected, of course, since Microfetch is
|
||||||
designed _explicitly_ for speed and makes some tradeoffs to achieve it's
|
designed _explicitly_ for speed and makes some tradeoffs to achieve its
|
||||||
signature speed.
|
signature speed.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Some tools are excluded. Yes, I know. If you think they are important and thus
|
||||||
|
> should be covered in the benchmarks, feel free to create an issue. The purpose
|
||||||
|
> of this benchmarks section is not to badmouth other projects, but to
|
||||||
|
> demonstrate how much faster Microfetch is in comparison. Obviously Microfetch
|
||||||
|
> is designed to be small (in the sense of scope) and fast (in every definition
|
||||||
|
> of the word) so I speak of Microfetch's speed as a fact rather than an
|
||||||
|
> advantage. Reddit has a surprising ability to twist words and misunderstand
|
||||||
|
> ideals.
|
||||||
|
|
||||||
### Benchmarking Individual Functions
|
### Benchmarking Individual Functions
|
||||||
|
|
||||||
[Criterion.rs]: https://github.com/bheisler/criterion.rs
|
[Criterion.rs]: https://github.com/bheisler/criterion.rs
|
||||||
|
|
@ -169,46 +186,62 @@ performance regressions.
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> You will need a Nerdfonts patched font installed, and for your terminal
|
> You will need a Nerd Fonts patched font installed, and for your terminal
|
||||||
> emulator to support said font. Microfetch uses nerdfonts glyphs by default,
|
> emulator to support said font. Microfetch uses Nerd Fonts glyphs by default,
|
||||||
> but this can be changed by [patching the program](#customizing).
|
> but this can be changed by [patching the program](#customizing).
|
||||||
|
|
||||||
Microfetch is packaged in [nixpkgs](https://github.com/nixos/nixpkgs). It can be
|
Microfetch is packaged in [nixpkgs](https://github.com/nixos/nixpkgs). It can be
|
||||||
installed by adding `pkgs.microfetch` to your `environment.systemPackages`.
|
installed by adding `pkgs.microfetch` to your `environment.systemPackages`.
|
||||||
Additionally, you can try out Microfetch in a Nix shell.
|
Additionally, you can try out Microfetch in a Nix shell or install it using
|
||||||
|
flakes on non-NixOS systems.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Enter a Nix shell with Microfetch; this will be lost on the next GC
|
||||||
nix shell nixpkgs#microfetch
|
nix shell nixpkgs#microfetch
|
||||||
|
|
||||||
|
# Install Microfetch globally; this will be kept on GC
|
||||||
|
nix profile add nixpkgs#microfetch
|
||||||
```
|
```
|
||||||
|
|
||||||
Or run it directly with `nix run`
|
Or run it directly with `nix run`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Run Microfetch from Nixpkgs. Subsequent runs will be faster.
|
||||||
nix run nixpkgs#microfetch
|
nix run nixpkgs#microfetch
|
||||||
```
|
```
|
||||||
|
|
||||||
Non-Nix users will have to build Microfetch with `cargo`. It is not published
|
[crates.io]: https://crates.io/crates/microfetch
|
||||||
anywhere but I imagine you can use `cargo install --git` to install it from
|
|
||||||
source.
|
Non-Nix users, if they plan to run this for some reason, will need to build
|
||||||
|
Microfetch from source or install it with `cargo`. Microfetch is published on
|
||||||
|
[crates.io] and can be installed with `cargo install`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install --git https://github.com/notashelf/microfetch.git
|
# Get Microfetch from crates.io
|
||||||
|
cargo install microfetch
|
||||||
```
|
```
|
||||||
|
|
||||||
Microfetch is _currently_ not available anywhere else. Though, does it _really_
|
### Other Distros
|
||||||
have to be?
|
|
||||||
|
<!-- Remove & replace with "unofficial" warning if adding distro-specific instructions -->
|
||||||
|
|
||||||
|
To my knowledge, there is no package for (nor a reason to package) Microfetch
|
||||||
|
but if you run a patched version for your distribution, feel free to leave your
|
||||||
|
repository (AUR, COPR, etc.) here as reference for those that might be
|
||||||
|
interested in Microfetch tailored to their distributions.
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|
||||||
You can't.
|
You can't*.
|
||||||
|
|
||||||
### Why?
|
### Why?
|
||||||
|
|
||||||
Customization, of most kinds, are expensive: I could try reading environment
|
Customization, of most kinds, is "expensive": I could try reading environment
|
||||||
variables, parse command-line arguments or read a configuration file to allow
|
variables, parse command-line arguments or read a configuration file to allow
|
||||||
configuring various fields but those inflate execution time and the resource
|
configuring various fields but those inflate execution time and the resource
|
||||||
consumption by a lot. Since Microfetch is closer to a code golf challenge than a
|
consumption by a lot. Since Microfetch is closer to a code golf challenge than a
|
||||||
program that attempts to fill a gap, I have elected not to make this trade.
|
program that attempts to fill a gap, I have elected not to make this trade. This
|
||||||
|
is, of course, not without a solution.
|
||||||
|
|
||||||
### Really?
|
### Really?
|
||||||
|
|
||||||
|
|
@ -217,13 +250,13 @@ program that attempts to fill a gap, I have elected not to make this trade.
|
||||||
|
|
||||||
To be fair, you _can_ customize Microfetch by, well, patching it. It is
|
To be fair, you _can_ customize Microfetch by, well, patching it. It is
|
||||||
certainly not the easiest way of doing so but if you are planning to change
|
certainly not the easiest way of doing so but if you are planning to change
|
||||||
something in Microfetch, patching is the best way to go. It will also the only
|
something in Microfetch, patching is the best way to go. It will also be the
|
||||||
way that does not compromise on speed, unless you patch in bad code. Various
|
only way that does not compromise on speed, unless you patch in bad code.
|
||||||
users have adapted Microfetch to their distribution by patching the
|
Various users have adapted Microfetch to their distribution of choice by
|
||||||
[main module] and inserting the logo of their choice. This is also the best way
|
patching the [main module] and inserting the logo of their choice. This is also
|
||||||
to go if you plan to make small changes. If your changes are not small, you
|
the best way to go if you plan to make small changes. If your changes are not
|
||||||
might want to look for a program that is designed to be customizable; Microfetch
|
small, you might want to look for a program that is designed to be customizable;
|
||||||
is built for maximum performance.
|
Microfetch is built for maximum performance and little else.
|
||||||
|
|
||||||
The Nix package allows passing patches in a streamlined manner by passing
|
The Nix package allows passing patches in a streamlined manner by passing
|
||||||
`.overrideAttrs` to the derivation. You can apply your patches in `patches` and
|
`.overrideAttrs` to the derivation. You can apply your patches in `patches` and
|
||||||
BIN
docs/assets/demo.png
Normal file
BIN
docs/assets/demo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
Loading…
Add table
Add a link
Reference in a new issue