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

Switch from triomphe::Arc to MiniArc, our own Arc implementation #456

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tatsuya6502
Copy link
Member

@tatsuya6502 tatsuya6502 commented Sep 14, 2024

This PR adds a crate private MiniArc type, a minimal implementation of atomic reference counted shared pointer. It is like a std::sync::Arc and triomphe::Arc but with a few differences:

  • No Weak references, so MiniArc does not have the weak reference counter.
  • Uses AtomicU32 instead of AtomicUsize for the strong reference counter.
  • Much smaller code size (~100 lines) by having only the necessary methods for moka and mini-moka.

MiniArc replaces all triomphe::Arc usages in moka.

On the CI (GitHub Actions), the following tests are performed in addition to the regular tests:

  • Miri tests on MiniArc.
  • Loom tests on MiniArc.

Fixes #440

Copy link

codecov bot commented Sep 14, 2024

Codecov Report

Attention: Patch coverage is 90.61033% with 20 lines in your changes missing coverage. Please review.

Project coverage is 94.73%. Comparing base (bd5e447) to head (14651ee).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #456      +/-   ##
==========================================
- Coverage   94.79%   94.73%   -0.07%     
==========================================
  Files          44       45       +1     
  Lines       20306    20416     +110     
==========================================
+ Hits        19249    19341      +92     
- Misses       1057     1075      +18     

@tatsuya6502 tatsuya6502 added this to the v0.12.9 milestone Sep 14, 2024
`MiniArc` is like a `std::sync::Arc` but with a few differences:

- No `Weak` references.
- Uses `AtomicU32` instead of `AtomicUsize` for reference counting.
- Much smaller code size by having only the necessary methods for us.
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.

Locking triomphe is the wrong approach to preserving MSRV
1 participant