Skip to content
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

Disable the quanta feature by default #482

Merged
merged 2 commits into from
Jan 5, 2025
Merged

Conversation

tatsuya6502
Copy link
Member

@tatsuya6502 tatsuya6502 commented Jan 5, 2025

This PR disables the quanta feature by default.

If it is manually enabled, quanta::Instant will be used for some performance critical operations in the cache instead of std::time::Instant.

The quanta crate is a high performance time measurement library and will be great for some use cases such as collecting performance metrics. moka used to use quanta::Instant all over the place by default. However, quanta is not very good for tracking cache entry expiration times because the time measurement can drift over time and it may not be monotonic on some specific hardware (#472). Therefore, using std::time::Instant is more appropriate for tracking entry expiration times.

As of v0.12.10, the quanta feature will not make any noticeable performance difference, but in the future when cache metrics are added, it will be useful to have this feature enabled.

Copy link

codecov bot commented Jan 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.31%. Comparing base (d22f4f3) to head (f7d2d29).
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #482   +/-   ##
=======================================
  Coverage   94.31%   94.31%           
=======================================
  Files          43       43           
  Lines       20490    20490           
=======================================
+ Hits        19325    19326    +1     
+ Misses       1165     1164    -1     

Base automatically changed from increase-time-accuracy to main January 5, 2025 23:25
Copy link
Member Author

@tatsuya6502 tatsuya6502 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging.

@tatsuya6502 tatsuya6502 merged commit 101e3a9 into main Jan 5, 2025
45 checks passed
@tatsuya6502 tatsuya6502 deleted the disable-quanta-by-default branch January 5, 2025 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant