{"id":31140905,"url":"https://github.com/qedk/fq","last_synced_at":"2025-09-18T12:55:29.817Z","repository":{"id":310568566,"uuid":"1040370576","full_name":"QEDK/fq","owner":"QEDK","description":"A simple ring-buffer based single-producer, single-consumer queue with no dependencies built on Rust.","archived":false,"fork":false,"pushed_at":"2025-08-25T17:13:05.000Z","size":75,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-17T16:58:56.446Z","etag":null,"topics":["fq","message-queue","messaging","queue","ring-buffer","spsc","spsc-queue"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/fq","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QEDK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-LGPL","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-18T21:53:38.000Z","updated_at":"2025-09-10T23:54:15.000Z","dependencies_parsed_at":"2025-08-19T00:14:00.196Z","dependency_job_id":"fcf33446-b690-4044-b1d8-73ced8d56d41","html_url":"https://github.com/QEDK/fq","commit_stats":null,"previous_names":["qedk/fq"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/QEDK/fq","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QEDK%2Ffq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QEDK%2Ffq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QEDK%2Ffq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QEDK%2Ffq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QEDK","download_url":"https://codeload.github.com/QEDK/fq/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QEDK%2Ffq/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275771602,"owners_count":25525892,"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","status":"online","status_checked_at":"2025-09-18T02:00:09.552Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["fq","message-queue","messaging","queue","ring-buffer","spsc","spsc-queue"],"created_at":"2025-09-18T12:55:27.962Z","updated_at":"2025-09-18T12:55:29.802Z","avatar_url":"https://github.com/QEDK.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastQueue (fq)\n[![Build Status](https://github.com/QEDK/fq/actions/workflows/ci.yml/badge.svg)](https://github.com/QEDK/fq/actions/workflows/ci.yml) [![Crates.io](https://img.shields.io/crates/l/fq?color=black)](LICENSE-MIT) [![Crates.io](https://img.shields.io/crates/v/fq?color=black)](https://crates.io/crates/fq) [![Released API docs](https://docs.rs/fq/badge.svg)](https://docs.rs/fq) [![Maintenance](https://img.shields.io/maintenance/yes/2025)](https://github.com/QEDK/fq)\n\nA fast and simple ring-buffer-based single-producer, single-consumer queue with no dependencies. You can use\nthis to write Rust programs with low-latency message passing. \n\n\u003e [!NOTE]\n\u003e This crate is experimental.\n\n## Installation\nAdd this to your `Cargo.toml`:\n```TOML\n[dependencies]\nfq = \"0.0.5\"\n```\n\n## Quickstart\n```rust\nuse fq::FastQueue;\nuse std::thread;\n\nlet (mut producer, mut consumer) = FastQueue::\u003cString\u003e::new(2);\n\nlet sender = thread::spawn(move || {\n    producer.push(\"Hello, thread\".to_owned())\n        .expect(\"Unable to send to queue\");\n});\n\nlet receiver = thread::spawn(move || {\n    while let Some(value) = consumer.next() {\n        assert_eq!(value, \"Hello, thread\");\n    }\n});\n\nsender.join().expect(\"The sender thread has panicked\");\nreceiver.join().expect(\"The receiver thread has panicked\");\n```\n\n## Examples\nSee the [examples](examples/README.md) directory for more usage examples.\n\n## How does it work?\nThe ring buffer structure allows for a contiguous data structure. The idea is that if we are able to get extreme\ncache locality, we can improve performance by reducing cache misses. This is also the reason why if you use\nsmart pointers like `Box\u003cT\u003e`, performance *may* degrade since cache locality gets degraded. For very large\n`T` types, you are more limited by `memcpy()` performance and less from queue implementations. As such,\nring buffers can be considered strongly optimized for data of a few word sizes with some non-linear performance\ndegradation for larger sizes. Additional optimizations are provided for CPUs that support `sse` and `prfchw`\ninstructions. As and when Rust `std` provides more relevant instructions, they will be added. This is simply a\nhigh-level explanation of some of the techniques employed by this crate, you can read the code to gain a better\nunderstanding of what's happening under the hood.\n\n## Profiles\nThe crate is fully synchronous and runtime-agnostic. We are heavily reliant on `std` for memory management, so\nit's unlikely that we will support `#[no_std]` runtimes anytime soon. You should be using the `release` or\n`maxperf` profiles for optimal performance.\n\n## Principles\n* This crate will always prioritize message throughput over memory usage.\n* This crate will always support generic types.\n* This crate will always provide a wait-free **and** lock-free API.\n* This crate will use unsafe Rust where possible for maximal throughput.\n\n## CPU Features\nOn `x86` and `x86_64` targets, prefetch instructions are available on the `stable` toolchain. To make use of prefetch instructions on the `aarch64` target, you should enable the `unstable` feature and use the `nightly`\ntoolchain.\n```TOML\n[dependencies]\nfq = { version = \"0.0.5\", features = [\"unstable\"] }\n```\n\n## Benchmarks\nBenchmarks are strictly difficult due to the nature of the program, it's somewhat simple to do a same-CPU\nbench but performance will still be affected based on the core type and cache contention. Benchmarks are\nprovided in the [benches](benches/bench.rs) directory and can be run with `cargo bench`. Contributions via\nPRs for additional benchmarks are welcome.\n\n## License\nLicensed under either of:\n * MIT license ([LICENSE-MIT](LICENSE-MIT))\n * Lesser General Public license v3.0 or later ([LICENSE-LGPL](LICENSE-LGPL))\nat your option.\n\n### Contribution\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you,\nas defined in the LGPL-3.0 license, shall be dual licensed as above, without any additional terms or conditions.\n\n## Acknowledgements\nInspired from the previous works of [fastqueue2](https://github.com/andersc/fastqueue2), [rigtorp](https://rigtorp.se/ringbuffer) and [rtrb](https://github.com/mgeier/rtrb).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqedk%2Ffq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqedk%2Ffq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqedk%2Ffq/lists"}