Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dezyh/atomics-benchmarks
https://github.com/dezyh/atomics-benchmarks
Last synced: 27 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/dezyh/atomics-benchmarks
- Owner: dezyh
- Created: 2022-01-27T14:39:49.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-01-27T15:20:35.000Z (almost 3 years ago)
- Last Synced: 2024-10-28T13:30:58.031Z (2 months ago)
- Language: Rust
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Testing Unsafe
Testing the unsafe version which could have UB seems to work every time.
```
❯ cargo test --release
Finished release [optimized] target(s) in 0.02s
Running unittests (target/release/deps/playground-621359cee22db8c6)running 1 test
test tests::unsafe_fn ... oktest result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 11.88s
```Benchmarking the variants
1. Using unsafe and u64 (fastest)
2. Using AtomicU64 with Relaxed ordering (slowest)
3. Using AtomicU64 with SeqCst ordering (middle)
```
❯ cargo bench
Finished bench [optimized] target(s) in 0.02s
Running unittests (target/release/deps/comparisons-ce0b61b0d98aed46)relaxed atomic u64 time: [354.97 us 357.73 us 360.50 us]
change: [-1.7974% -0.6551% +0.3996%] (p = 0.26 > 0.05)
No change in performance detected.
Found 4 outliers among 100 measurements (4.00%)
4 (4.00%) low mildunsafe ub u64 time: [55.739 us 56.077 us 56.423 us]
change: [+0.5772% +1.6940% +2.8310%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 3 outliers among 100 measurements (3.00%)
1 (1.00%) low mild
2 (2.00%) high mildseqcst atomic u64 time: [274.18 us 277.04 us 280.05 us]
change: [-4.1724% -2.7916% -1.4354%] (p = 0.00 < 0.05)
Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
```