{"id":15067622,"url":"https://github.com/mnwa/fast-async-mutex","last_synced_at":"2025-04-10T14:23:02.970Z","repository":{"id":55930886,"uuid":"292914969","full_name":"Mnwa/fast-async-mutex","owner":"Mnwa","description":"The fast async mutex which uses spinlock algorithm with using waker","archived":false,"fork":false,"pushed_at":"2020-12-06T12:16:42.000Z","size":273,"stargazers_count":11,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T13:05:01.927Z","etag":null,"topics":["concurrency","mutex","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mnwa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-04T18:04:23.000Z","updated_at":"2024-09-19T02:58:25.000Z","dependencies_parsed_at":"2022-08-15T09:40:52.363Z","dependency_job_id":null,"html_url":"https://github.com/Mnwa/fast-async-mutex","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mnwa%2Ffast-async-mutex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mnwa%2Ffast-async-mutex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mnwa%2Ffast-async-mutex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mnwa%2Ffast-async-mutex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mnwa","download_url":"https://codeload.github.com/Mnwa/fast-async-mutex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248233937,"owners_count":21069493,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurrency","mutex","rust"],"created_at":"2024-09-25T01:25:17.009Z","updated_at":"2025-04-10T14:23:02.956Z","avatar_url":"https://github.com/Mnwa.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fast-async-mutex\n[![](https://github.com/Mnwa/fast-async-mutex/workflows/build/badge.svg?branch=master)](https://github.com/Mnwa/fast-async-mutex/actions?query=workflow%3Abuild)\n[![](https://docs.rs/fast-async-mutex/badge.svg)](https://docs.rs/fast-async-mutex/)\n[![](https://img.shields.io/crates/v/fast-async-mutex.svg)](https://crates.io/crates/fast-async-mutex)\n[![](https://img.shields.io/crates/d/fast-async-mutex.svg)](https://crates.io/crates/fast-async-mutex)\n\nIt is a lib which provide asynchronous locking mechanisms, which used spinlock algorithm.\nIt's maybe very efficient because when mutex tries to acquire data unsuccessfully, these returning control to an async runtime back.\nThis lib built only on atomics and don't use others std synchronous data structures, which make this lib so fast.\n\n## Examples\n\n```rust\nuse fast_async_mutex::mutex::Mutex;\n\n#[tokio::main]\nasync fn main() {\n    let mutex = Mutex::new(10);\n    let guard = mutex.lock().await;\n    assert_eq!(*guard, 10);\n}\n```\n\n## Benchmarks\n\nThere is result of benchmarks which runs on `MacBook Pro (16-inch, 2019) 2,3 GHz 8-Core Intel Core i9 16GB RAM`\nTests you can find in the [benchmarks dir](benchmarks).\n```\nrunning 35 tests\ntest mutex::fast_async_mutex::tests::concurrency_without_waiting          ... bench:      49,844 ns/iter (+/- 3,223)\ntest mutex::fast_async_mutex::tests::create                               ... bench:           0 ns/iter (+/- 0)\ntest mutex::fast_async_mutex::tests::step_by_step_without_waiting         ... bench:      22,685 ns/iter (+/- 18,466)\ntest mutex::fast_async_mutex_ordered::tests::concurrency_without_waiting  ... bench:      50,173 ns/iter (+/- 1,163)\ntest mutex::fast_async_mutex_ordered::tests::create                       ... bench:           0 ns/iter (+/- 0)\ntest mutex::fast_async_mutex_ordered::tests::step_by_step_without_waiting ... bench:      22,007 ns/iter (+/- 2,974)\ntest mutex::futures::tests::concurrency_without_waiting                   ... bench:      76,535 ns/iter (+/- 12,181)\ntest mutex::futures::tests::create                                        ... bench:          92 ns/iter (+/- 17)\ntest mutex::futures::tests::step_by_step_without_waiting                  ... bench:      23,109 ns/iter (+/- 7,627)\ntest mutex::smol::tests::concurrency_without_waiting                      ... bench:      66,312 ns/iter (+/- 4,924)\ntest mutex::smol::tests::create                                           ... bench:           0 ns/iter (+/- 0)\ntest mutex::smol::tests::step_by_step_without_waiting                     ... bench:      28,466 ns/iter (+/- 3,385)\ntest mutex::tokio::tests::concurrency_without_waiting                     ... bench:      60,833 ns/iter (+/- 11,640)\ntest mutex::tokio::tests::create                                          ... bench:           6 ns/iter (+/- 3)\ntest mutex::tokio::tests::step_by_step_without_waiting                    ... bench:      31,924 ns/iter (+/- 9,327)\ntest rwlock::fast_async_mutex::tests::concurrency_read                    ... bench:      53,613 ns/iter (+/- 4,125)\ntest rwlock::fast_async_mutex::tests::concurrency_write                   ... bench:      50,652 ns/iter (+/- 1,181)\ntest rwlock::fast_async_mutex::tests::create                              ... bench:           0 ns/iter (+/- 0)\ntest rwlock::fast_async_mutex::tests::step_by_step_read                   ... bench:      23,161 ns/iter (+/- 5,225)\ntest rwlock::fast_async_mutex::tests::step_by_step_writing                ... bench:      23,330 ns/iter (+/- 4,819)\ntest rwlock::fast_async_mutex_ordered::tests::concurrency_read            ... bench:      50,208 ns/iter (+/- 896)\ntest rwlock::fast_async_mutex_ordered::tests::concurrency_write           ... bench:      50,227 ns/iter (+/- 1,984)\ntest rwlock::fast_async_mutex_ordered::tests::create                      ... bench:           0 ns/iter (+/- 0)\ntest rwlock::fast_async_mutex_ordered::tests::step_by_step_read           ... bench:      23,059 ns/iter (+/- 2,393)\ntest rwlock::fast_async_mutex_ordered::tests::step_by_step_writing        ... bench:      22,074 ns/iter (+/- 5,107)\ntest rwlock::smol::tests::concurrency_read                                ... bench:      55,767 ns/iter (+/- 1,843)\ntest rwlock::smol::tests::concurrency_write                               ... bench:      85,189 ns/iter (+/- 2,852)\ntest rwlock::smol::tests::create                                          ... bench:           1 ns/iter (+/- 0)\ntest rwlock::smol::tests::step_by_step_read                               ... bench:      22,644 ns/iter (+/- 1,688)\ntest rwlock::smol::tests::step_by_step_writing                            ... bench:      25,769 ns/iter (+/- 2,010)\ntest rwlock::tokio::tests::concurrency_read                               ... bench:      52,960 ns/iter (+/- 939)\ntest rwlock::tokio::tests::concurrency_write                              ... bench:      60,748 ns/iter (+/- 4,604)\ntest rwlock::tokio::tests::create                                         ... bench:           5 ns/iter (+/- 1)\ntest rwlock::tokio::tests::step_by_step_read                              ... bench:      31,437 ns/iter (+/- 6,948)\ntest rwlock::tokio::tests::step_by_step_writing                           ... bench:      29,766 ns/iter (+/- 8,081)\n\ntest result: ok. 0 passed; 0 failed; 0 ignored; 35 measured; 0 filtered out\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n#### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnwa%2Ffast-async-mutex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnwa%2Ffast-async-mutex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnwa%2Ffast-async-mutex/lists"}