https://github.com/holly-hacker/mini-jc
A jc clone with reasonable performance
https://github.com/holly-hacker/mini-jc
command-line jc jq json shell-scripting
Last synced: about 1 year ago
JSON representation
A jc clone with reasonable performance
- Host: GitHub
- URL: https://github.com/holly-hacker/mini-jc
- Owner: holly-hacker
- License: mit
- Created: 2024-02-24T16:59:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-24T19:52:33.000Z (over 2 years ago)
- Last Synced: 2025-05-07T18:14:24.057Z (about 1 year ago)
- Topics: command-line, jc, jq, json, shell-scripting
- Language: Rust
- Homepage:
- Size: 12.7 KB
- Stars: 6
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `mini-jc`
A [jc](https://github.com/kellyjonbrazil/jc) clone with reasonable performance.
## Motivation
I use `jc` to show system stats in my taskbar on my Linux setup. Since `jc` is written in Python, it took ~50ms to spin up, parse the 3 lines of output from `free` and output it as json. I found this too slow as I have to run this every second and I don't want to give up a permanent 5% of a CPU core just to show my memory usage.
Also I was bored.
## Installation
### Using a Rust toolchain
Run `cargo install --git https://github.com/holly-hacker/mini-jc`.
## Differences from `jc`
- `mini-jc` is a single, statically linked executable so it is fairly to install
- `mini-jc` executes magnitudes faster due to not having to start up a runtime
- `mini-jc` supports way fewer parsers. I will likely only add support for tools I use myself.
- `mini-jc` will convert "human-readable" sizes to absolute values
- `mini-jc` tries to copy `jc`'s output naming, but doesn't do so everywhere
## Supported parsers
- `free`: matches `jc`
- `df`: matches `jc`, property names have being changed to be more consistent
## Performance
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `jc --free` | 44.3 ± 0.3 | 43.7 | 45.5 | 112.19 ± 9.90 |
| `mini-jc free` | 0.4 ± 0.0 | 0.3 | 1.1 | 1.00 |
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| `jc --df` | 46.8 ± 0.8 | 46.0 | 50.8 | 111.48 ± 10.33 |
| `mini-jc df` | 0.4 ± 0.0 | 0.3 | 0.7 | 1.00 |