New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time: small implementation cleanups #6517
Commits on Apr 25, 2024
-
time: use
compare_exchange_weak
inStateCell::mark_pending
`StateCell::mark_pending` already uses a loop to retry the compare exchange operation if it fails. The logic within the loop would handle a spurious failure like any other failure, so `compare_exchange_weak` makes the implementation more efficient for some platforms.
Configuration menu - View commit details
-
Copy full SHA for bda0d8f - Browse repository at this point
Copy the full SHA bda0d8fView commit details -
time: use
saturating_duration_since
inTimeSource::instant_to_tick
This replaces a manual implementation of `Instant::saturating_duration_since` with the actual one. Clippy already catches this for primitive integer types via the `manual_saturating_arithmetic` lint, as demonstrated by the following example: ```rs fn saturating_sub(val: usize, n: usize) -> usize { val.checked_sub(n).unwrap_or(0) } ```
Configuration menu - View commit details
-
Copy full SHA for 47a8f06 - Browse repository at this point
Copy the full SHA 47a8f06View commit details -
time: use
array::from_fn
inLevel::new
As explained by the comment removed by this commit earlier Rust versions didn't have an ergonomic way of building arrays of any size of non-Copy types. Rust 1.63 stabilized `array::from_fn`, fixing the above issue and by making it easy to construct arrays from a constructor.
Configuration menu - View commit details
-
Copy full SHA for a76b09c - Browse repository at this point
Copy the full SHA a76b09cView commit details -
time: use array instead of
Vec
inWheel::levels
This replaces `Wheel::levels`, currently represented as a `Vec` of 6 elements, into an array. This should help eliminate some bounds checks from accesses to `levels`. This changes the size of `Wheel` from 48 bytes to 32 bytes on x86_64. The initial implementation didn't Box the array, resulting into `Wheel` having a size of 6264 bytes and loom tests overflowing their stack.
Configuration menu - View commit details
-
Copy full SHA for 79559ac - Browse repository at this point
Copy the full SHA 79559acView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2ccecf8 - Browse repository at this point
Copy the full SHA 2ccecf8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 404aafc - Browse repository at this point
Copy the full SHA 404aafcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 368a4dd - Browse repository at this point
Copy the full SHA 368a4ddView commit details -
Configuration menu - View commit details
-
Copy full SHA for 50a9245 - Browse repository at this point
Copy the full SHA 50a9245View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8d97f9b - Browse repository at this point
Copy the full SHA 8d97f9bView commit details -
time: use
WakeList
inHandle::process_at_time
Replaces the manual implementation of a waker list with `WakeList`.
Configuration menu - View commit details
-
Copy full SHA for 49feda1 - Browse repository at this point
Copy the full SHA 49feda1View commit details -
Configuration menu - View commit details
-
Copy full SHA for c329e01 - Browse repository at this point
Copy the full SHA c329e01View commit details