Replace most uses of quanta::Instant
with std::time::Instant
to increase the accuracy of time measurements
#481
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR does the following:
quanta::Instant
withstd::time::Instant
to increase the accuracy of time measurements.quanta
feature ofmoka
is disabled,std::time::Instant
is used for all time measurements.std::time::Instant
.std::time::Instant
is the same as usingquanta::Instant
.moka
keeps three timestamps for each cache entry. (last accessed time, last modified time, and expiration time)AtomicU64
(8 bytes) in nanoseconds.Mutex<std::time::Instant>
, which is 24 bytes on Rust 1.83 for Linux x86_64 target.quanta
is a high-performance time measurement library and will be great for some use cases such as collecting performance metrics. However, it is not very suitable for tracking expiration times of cache entries because the time measurement may drift over time, and it may not be monotonic on some specific hardware (#472). Therefore, usingstd::time::Instant
will be more appropriate for tracking expiration times of cache entries.(I created PR #482 to disable the
quanta
feature ofmoka
by default)