mirror of
https://github.com/NotAShelf/tinierfetch.git
synced 2024-11-22 21:31:11 +00:00
2 KiB
2 KiB
tinierfetch
a self-imposed code-golf challenge on following qualifiers
- speed
- binary size
- compilation duration
- (optional) lines of code
depends
you will need TERM
, LANG
, USER
, SHELL
environmental variables to be set, they usually are.
- for C++, see the Makefile for available jobs.
- for Rust, the
--release
profile handles the optimizations for you - for Go, you will want to pass
-ldflags="-s -w"
togo build
usage
a helper script is provided below. it will build each program and compare them using Hyperfine
it fits in a QR code
todo
- more languages:
- bash
- zig
- python
- ruby
- haskell
- asm
- node
results
Command | Mean [ms] | Min [ms] | Max [ms] | Relative | Compilation Duration [s] | Notes |
---|---|---|---|---|---|---|
bin/tinierfetch-go |
1.3 ± 0.1 | 1.1 | 1.6 | 1.23 ± 0.12 | 0.15 | -s and -w ldflags are used |
bin/tinierfetch-rs |
1.1 ± 0.1 | 0.9 | 1.3 | 1.00 | 3.17 | see Cargo.toml for opitimization specs |
bin/tinierfetch-cpp-size |
1.5 ± 0.1 | 1.3 | 1.8 | 1.43 ± 0.11 | 0.24 | g++ optimized for binary size |
bin/tinierfetch-cpp-speed |
1.5 ± 0.1 | 1.3 | 1.8 | 1.43 ± 0.11 | 0.10 | g++ optimized for speed |
all programs take around 0.001
to 0.002s
to execute, have been tested on R5 3600x and R7 7730U CPUs
verdict
Use
- Rust, for speed
- C++, for optimized size
- Go, if you hate yourself (or can't tolerate Rust syntax)
contributing
You know something better? Do feel free to contribute additional languages, improvements or QoL changes to the repository.
Got different results? Open an issue, prove me wrong mathematically.