Repository navigation
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
d5655b0 to
7f9550a
Compare
720f62a to
0b08ed3
Compare
Merging this PR will regress 3 benchmarksWarning uutils has exceeded the Hobby plan limit of 5 active contributors. Upgrade your plan or apply to the open source program by December 8, 2026 to keep using CodSpeed. 2 warnings, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
be024a4 to
0eadf63
Compare
| use libc::getloadavg; | ||
|
|
||
| let mut avg: [c_double; 3] = [0.0; 3]; | ||
| // SAFETY: checked whether it returns -1 |
There was a problem hiding this comment.
By the way, a SAFETY comment must explain why an unsafe operation is sound, which this comment does not do.
There was a problem hiding this comment.
And we should check == 3 to ensure initialize RAM instead of != -1 ? But this can be separated PR.
| } | ||
|
|
||
| #[cfg(target_arch = "wasm32")] | ||
| pub fn get_loadavg() -> UResult<(f64, f64, f64)> { |
There was a problem hiding this comment.
It's a bit suspicious we have such a function that always returns an error, rather than gating cfg at the call sites.
There was a problem hiding this comment.
We can drop wasm32 later. diff is minimal at here.
|
GNU testsuite comparison: |
| } | ||
|
|
||
| #[test] | ||
| fn test_get_load_average() { |
There was a problem hiding this comment.
could you put it in a #[cfg(test)] mod tests and also check the 3 values are >= 0?
There was a problem hiding this comment.
It is difficult since other tests are gated by apple.
0eadf63 to
29a3a6f
Compare
Also drop wasm32 cfg (wasip-shim is enough for browsers).