Commit graph

17 commits

Author SHA1 Message Date
75132ff172
treewide: remove nix dependency, add custom syscall wrappers & UtsName
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ib880f4bafe9d3bbc944af4b9125256366a6a6964
2025-11-17 21:29:15 +03:00
f4f3385ff7
various: fix clippy warnings
- Adds proper documentation comments with `# Errors` sections for all
  functions returning `Result`
- `cast_precision_loss` on `u64` -> `f64` for disk sizes is acceptable
  since disk sizes won't exceed f64's precision limit in practice.
  Thus, we can suppress those.
- `cast_sign_loss` and `cast_possible_truncation` on the percentage
  calculation is safe since percentages are always 0-100. Once again,
  it's safe to suppress.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Id4dd7ebc9674407d2be4f38ff4de24bc6a6a6964
2025-11-17 18:26:34 +03:00
2ad765ef98
various: reduce allocations where available
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I517d855b14c015569a325deb64948f3b6a6a6964
2025-11-17 18:11:45 +03:00
2a6fe2a3f1
treewide: set up Hotpath for benchmarking individual allocations
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I0351e5753996e6d0391fc9e2f329878a6a6a6964
2025-11-17 17:40:46 +03:00
9bd4c9a70a
treewide: format with nightly rustfmt rules
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ib8502372dafe2e970024f606b44825af6a6a6964
2025-11-17 16:20:43 +03:00
ErrorNoInternet
c139026704
refactor: clean up a few things
I've decided to keep lazy_static for now as std::sync::LazyLock seems to
have a slightly bigger impact on binary size.
2025-04-15 03:46:15 -04:00
592fb58474
get rid of color_eyre
Should never have added it. Annoyingly long compile times for no reason...
2025-01-26 00:57:02 +03:00
fd18e9d244
release: conditionally improve performance for get_os_pretty_name
It is difficult to get completely accurate benchmarks, given how small
the numbers we are dealing with are, but this seems to point at an
overall trend of *slightly* faster execution. The change minimizes
unnecessary memory allocations and string manipulations, to help ensure
more performant line reading and immediate return upon finding the
PRETTY_NAME without additional, redundant operations.
2024-12-19 18:30:33 +03:00
3960b37089
faster release parsing
Some checks are pending
Rust / build (push) Waiting to run
Around 20% faster when you think about it, but results vary because of hardware race conditions.
2024-12-09 17:30:57 +03:00
Ryan
907112f2d1
micro optimizations (#8)
* perf: break early after parsing required meminfo

Also a match statement for compiler magic.

* perf: pre-allocate strings when reading files

* refactor: remove duplicate .to_string()

* perf: try to print everything in one syscall

println! sends a syscall for each line.

* perf: get rid of duplicate uname syscall

* perf: simplify first letter capitalization

* refactor: directly use key in match statement
2024-08-15 10:32:02 +00:00
Sora
ae76a0cbe1
refactor: remove some redundant error types (#4) 2024-08-13 20:59:11 +00:00
Ryan
13903539b7
perf: use nix::sys::utsname::uname for less syscalls (#2)
Instead of reading multiple files to get the `sysname`, `release`, and
`machine` name, use the `nix::sys::utsname::uname` function which sends a
single uname syscall instead. This increases performance and portability.

From my observations, there are ~10 less syscalls.
2024-08-05 08:08:25 +00:00
81cdc0a281
speeding it up 2024-08-04 12:44:19 +03:00
cff4332122
clippy lints 2024-08-04 00:12:07 +03:00
0e4b2d2ac1
cleanup 2024-08-04 00:05:57 +03:00
42a7f2fc77
apply clippy lints 2024-08-03 23:04:26 +03:00
29e4ccc806
modularize 2024-08-03 20:42:48 +03:00