# sys-lib v0.7.0 - Optimisation
**Every reading measured.** sys-lib was benchmarked against sysinfo, num_cpus, os_info, raw-cpuid, and machine-uid on Linux (x86-64, Arm64, and a container with limits), Windows, and macOS (Apple silicon and Intel), warm and in a fresh process. The numbers, the method, and the reason for each reading not yet 20% ahead are in `docs/PERFORMANCE.md`. This release also carries the fixes from an independent review of 0.6.0.
## Faster
- Static facts after the first call cost 1 to 7 ns, against microseconds for competitors that read again.
- The first `cpu::logical()` on Linux reads one small file: 23 µs against num_cpus's 94 µs.
- Windows `mem::snapshot()` takes 1.3 µs (sysinfo: 9 µs), Windows `disk::list()` remembers each volume's kind, and `host::name()` is read once.
- `process::memory()`, `cpu::Sampler`, `disk::IoSampler`, `host::uptime()`, and `host::processes()` are 2x to several hundred times faster than sysinfo's refreshes.
## The process guard
- **The default lock directory now depends only on the user**, not on `$XDG_RUNTIME_DIR` or `$HOME`: `/run/<name>` for root on Linux, and under the account's home directory for other users. A copy started by systemd and one started from a shell now find the same lock.
- The guard re-checks the lock file after locking it, and on Windows the held file cannot be deleted. `Guard::is_held()` tells a long-running service when its lock file has been removed.
## Fixed
- 32-bit Linux: login sessions and `cpu::is_32bit()`.
- `disk::of()` on hosts with thousands of mounts, and with mount points longer than 8 KiB.
- A FIFO at a file path such as `/etc/os-release` no longer blocks the caller.
- The readiness report no longer shows the data directory's mount source, and cannot be given extra rows by a crafted mount name.
- Hostile CPU lists parse in microseconds; cgroup roots match by whole path components.
## Upgrading
```toml
[dependencies]
sys = { package = "sys-lib", version = "0.7" }
```
Three changes can be noticed:
- `process::guard(name)` takes its lock in a new place. A copy of 0.6 and a copy of 0.7 running at the same time do not see each other's lock; stop the old one first. A program guarding shared data should pass its data directory with `lock_dir`.
- A user without a home directory in the account database needs `lock_dir`.
- `Memory::cached` is `None` on Windows.
The changelog lists everything.