{"id":51604881,"url":"https://github.com/shpegun60/spsc","last_synced_at":"2026-07-12T01:01:42.947Z","repository":{"id":334602993,"uuid":"1137023371","full_name":"shpegun60/spsc","owner":"shpegun60","description":"High-performance C++ SPSC buffer library for desktop and embedded systems: fifo, queue, pool, latest, typed_pool, array_fifo, chunk_fifo, and non-owning views.","archived":false,"fork":false,"pushed_at":"2026-06-01T20:12:10.000Z","size":63934,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-01T20:26:40.263Z","etag":null,"topics":["concurrency","cpp","embedded","fifo","freertos","lock-free","queue","ring-buffer","spsc","stm32"],"latest_commit_sha":null,"homepage":"https://github.com/shpegun60/spsc/tree/main/src/spsc/docs","language":"C++","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/shpegun60.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-18T19:21:48.000Z","updated_at":"2026-06-01T20:12:14.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/shpegun60/spsc","commit_stats":null,"previous_names":["shpegun60/spsc"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/shpegun60/spsc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shpegun60%2Fspsc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shpegun60%2Fspsc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shpegun60%2Fspsc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shpegun60%2Fspsc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shpegun60","download_url":"https://codeload.github.com/shpegun60/spsc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shpegun60%2Fspsc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35378723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-11T02:00:05.354Z","response_time":104,"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":["concurrency","cpp","embedded","fifo","freertos","lock-free","queue","ring-buffer","spsc","stm32"],"created_at":"2026-07-12T01:01:33.645Z","updated_at":"2026-07-12T01:01:42.928Z","avatar_url":"https://github.com/shpegun60.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SPSC Test Project\n\nMain integration project for the `spsc` buffer library and paranoid API tests.\n\n![Qt dashboard with all test suites passed](img/Screenshot%202026-03-21%20141744.png)\n\nQuick links:\n\n- [Changelog](CHANGELOG.md)\n- [Quick Start](src/spsc/README.md)\n- [Documentation Hub](src/spsc/docs/README.md)\n- [Common Concepts](src/spsc/docs/common-concepts.md)\n- [Concurrency and FreeRTOS](src/spsc/docs/concurrency-and-freertos.md)\n- [Method Recipes](src/spsc/docs/method-recipes.md)\n- [Guard and Bulk Helpers](src/spsc/docs/guard-and-bulk-helpers.md)\n\n## Comparison With Other SPSC Libraries\n\nThis is a practical feature matrix against popular and representative SPSC and SPSC-adjacent queues or FIFO helpers from the wider C/C++ ecosystem.\n\nIt is intentionally not a throughput ranking. The goal is to show what this project covers as first-class API surface, and what other libraries do or do not cover.\n\nImportant comparison rule:\n\n- A checked cell means the capability exists as a documented, built-in part of that library's primary API.\n- An empty cell does not mean the behavior is impossible to build on top, only that it is not a first-class built-in feature of that library.\n\nOfficial links:\n\n- [`spsc`](src/spsc/README.md) - this project\n- [`Boost lockfree::spsc_queue`](https://www.boost.org/doc/libs/latest/doc/html/doxygen/classboost_1_1lockfree_1_1spsc__queue.html)\n- [`ETL queue_spsc_atomic`](https://www.etlcpp.com/queue_spsc_atomic.html)\n- [`ETL queue_spsc_locked`](https://www.etlcpp.com/queue_spsc_locked.html)\n- [`rigtorp/SPSCQueue`](https://github.com/rigtorp/SPSCQueue)\n- [`moodycamel::ReaderWriterQueue`](https://github.com/cameron314/readerwriterqueue)\n- [`folly::ProducerConsumerQueue`](https://github.com/facebook/folly/blob/main/folly/ProducerConsumerQueue.h)\n- [`PortAudio PaUtilRingBuffer`](https://portaudio.com/docs/v19-doxydocs-dev/pa__ringbuffer_8h.html)\n- [`JUCE AbstractFifo`](https://docs.juce.com/master/classjuce_1_1AbstractFifo.html)\n- [`atomic_queue`](https://github.com/max0x7ba/atomic_queue)\n\nLegend:\n\n- `[x]` built in as a first-class API\n- `[ ]` not part of the library's primary API surface\n\nThe `ETL` column below refers to the SPSC family formed by `queue_spsc_atomic` and `queue_spsc_locked`.\n\n### API Model Matrix\n\n| API Model | spsc | Boost | ETL | Rigtorp | Moodycamel | Folly | PortAudio | JUCE | atomic_queue |\n| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |\n| Simple value enqueue/dequeue API | [x] | [x] | [x] | [x] | [x] | [x] | [ ] | [ ] | [x] |\n| In-place producer construction API (`emplace`-style) | [x] | [ ] | [x] | [x] | [x] | [x] | [ ] | [ ] | [ ] |\n| True `claim()` / `publish()` producer model | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] |\n| Staged producer API (`prepare/finished`, `regions/advance`) | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [x] | [x] | [ ] |\n| Consumer peek/front without immediate consume | [x] | [x] | [ ] | [x] | [x] | [x] | [ ] | [ ] | [ ] |\n| Bulk or region-based read/write helpers | [x] | [x] | [ ] | [ ] | [ ] | [ ] | [x] | [x] | [ ] |\n| Snapshot or captured-range consumer API | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] |\n| Dedicated blocking queue variant / wait methods | [ ] | [ ] | [ ] | [ ] | [x] | [ ] | [ ] | [ ] | [ ] |\n\n### Capability Matrix\n\n| Capability | spsc | Boost | ETL | Rigtorp | Moodycamel | Folly | PortAudio | JUCE | atomic_queue |\n| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |\n| Compile-time fixed-capacity form | [x] | [x] | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [x] |\n| Runtime-sized queue form | [x] | [x] | [ ] | [x] | [x] | [x] | [x] | [x] | [x] |\n| External caller-owned storage | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [x] | [x] | [ ] |\n| Typed non-owning view container | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] |\n| Raw byte / DMA-slot abstraction | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [x] | [ ] | [ ] |\n| Newest-only buffer (`latest`) | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] |\n| Fixed-array / block wrappers (`array_fifo`, `chunk_fifo`) | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] |\n| Separate lifetime-managed queue type (`queue`) | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] |\n| Explicit ISR / callback handoff story in official docs | [x] | [ ] | [x] | [ ] | [ ] | [ ] | [x] | [ ] | [ ] |\n| Multiple distinct SPSC container models in one library | [x] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] | [ ] |\n\n### Power-of-Two Capacity Behavior\n\n| Library | Power-of-two behavior | Real implication |\n| --- | --- | --- |\n| `spsc` | Static capacities are required to be power-of-two; dynamic capacities are normalized to an effective power-of-two geometry | The ring is explicitly designed around mask-based wrap and unambiguous index arithmetic |\n| Boost `spsc_queue` | No documented power-of-two requirement | Treat it as an arbitrary-capacity typed queue unless you choose a power-of-two size for your own reasons |\n| ETL SPSC family | No documented power-of-two requirement | Fixed-capacity embedded queues, but not presented as power-of-two-only queues |\n| `rigtorp/SPSCQueue` | Explicitly supports arbitrary non-power-of-two capacities | It intentionally spends one extra slot instead of forcing a power-of-two restriction |\n| `moodycamel::ReaderWriterQueue` | No documented power-of-two requirement | Runtime-sized queue/growing queue model, not documented as power-of-two-constrained |\n| `folly::ProducerConsumerQueue` | No documented power-of-two requirement | Runtime-sized fixed queue, but not documented as a power-of-two-only design |\n| PortAudio `PaUtilRingBuffer` | Element count must be a power-of-two | This is the strongest explicit power-of-two requirement in the compared set |\n| JUCE `AbstractFifo` | No documented power-of-two requirement | It is an index manager over your buffer size, not a power-of-two-specialized ring API |\n| `atomic_queue` | Any fixed size is supported, but power-of-two size enables extra optimizations | It benefits from power-of-two geometry but does not strictly require it |\n\n### Real Conclusions\n\n- Boost, Rigtorp, Moodycamel, Folly, ETL, and `atomic_queue` are primarily \"one queue API\" libraries. They differ in performance goals and ergonomics, but they are still fundamentally queue-centric.\n- This project is materially different because it is not only a queue. It gives you multiple SPSC transport models under one API family: assignment queue, lifetime-managed queue, typed pool, raw pool, external-storage views, newest-only state handoff, fixed-array wrappers, and chunk/block wrappers.\n- If power-of-two geometry is part of your design philosophy, this project and PortAudio are the clearest explicit matches in the compared set. `atomic_queue` also leans into power-of-two optimizations, but does not make them mandatory.\n- If you need caller-owned memory, only `spsc`, PortAudio, and JUCE cover that directly in the compared set. But PortAudio is a C raw ring buffer and JUCE is an index manager over your buffer; neither gives you typed non-owning view containers comparable to `fifo_view`, `pool_view`, or the view wrappers here.\n- If you need a real `claim()/publish()` workflow, this project is the only one in this comparison that exposes it as a first-class API model. PortAudio and JUCE provide staged write/read mechanics, but not the same queue abstraction shape.\n- If you need newest-state semantics, the compared alternatives do not really match `latest`. With the others you would emulate that policy above a normal queue; here it is a dedicated container model.\n- If you need raw DMA-style byte slots with policy-aware alignment and external-storage variants, the closest conceptual neighbor is PortAudio's ring buffer, but PortAudio stays much lower-level and C-oriented.\n- ETL is the strongest direct alternative when the target is embedded/ISR handoff and you want a simpler fixed-capacity queue with explicit interrupt-oriented documentation.\n- Boost is the strongest direct alternative when you mainly want a mature general-purpose typed SPSC queue with wait-free push/pop and some bulk helpers, but you do not need views, raw pools, or newest-only semantics.\n- Rigtorp and Moodycamel are strongest when you mainly want a narrow high-performance typed queue API. They are excellent queue implementations, but they do not try to become a full SPSC container toolkit.\n\nNotes:\n\n- This is a representative set, not a claim that these are literally all SPSC queues on the Internet.\n- Some entries are pure SPSC queues, while others are lower-level FIFO primitives that solve adjacent SPSC problems.\n- Matrix rows mean \"the capability exists somewhere in the library's primary API surface\", not necessarily that every type in that library exposes it.\n- `JUCE AbstractFifo` is fundamentally an index-management helper over user storage, not a typed queue container.\n- `PortAudio PaUtilRingBuffer` is a C single-reader / single-writer raw ring buffer over caller-owned memory, not a family of typed C++ containers.\n- `rigtorp/SPSCQueue` does provide blocking `push` / `emplace` when full, but not a separate blocking queue type with explicit wait-style dequeue methods like Moodycamel's blocking variant.\n- If you only need one typed queue, Boost, ETL, Rigtorp, Moodycamel, Folly, PortAudio, JUCE, or `atomic_queue` may be a better fit simply because they are narrower.\n- If you need one library to cover typed values, explicit lifetime control, raw DMA-style buffers, external storage views, newest-value handoff, and block wrappers, this project is deliberately broader.\n\n## What Is Here\n\n- `src/spsc/`: core SPSC library headers (`fifo`, `queue`, `typed_pool`, `fifo_view`, `pool`, `pool_view`, `latest`, `chunk`, etc.).\n- `src/tests/*_test.cpp`: paranoid test suites for each buffer type.\n- `spsc_test.pro`: Qt/qmake project file.\n- `mainwindow.cpp`: Qt dashboard that runs suites, shows `PASS/FAIL`, logs, and timeout status.\n\nDetailed API documentation is in:\n\n- `src/spsc/README.md` for the quick start and top-level overview\n- `src/spsc/docs/README.md` for the new split-by-container documentation hub\n- `src/spsc/docs/concurrency-and-freertos.md` for task/ISR/FreeRTOS guidance\n\n## Build\n\nPrerequisites:\n\n- Qt 6.x with `QtTest`\n- MinGW toolchain (or compatible C++ toolchain configured in Qt)\n\nTypical qmake build flow (Windows/MinGW):\n\n```powershell\nmkdir build\ncd build\nqmake ..\\spsc_test.pro\nmingw32-make -j8\n```\n\nIf you use Qt Creator, opening `spsc_test.pro` is enough.\n\n## Run Tests\n\nLaunch the Qt dashboard:\n\n```powershell\n.\\bin\\debug\\spsc_launcher.exe\n# or\n.\\bin\\release\\spsc_launcher.exe\n```\n\nThe dashboard and runner executables are built per configuration:\n\n```powershell\n.\\bin\\debug\\spsc_test_shadow_on.exe --run-suite fifo\n.\\bin\\release\\spsc_test_shadow_on.exe --run-suite fifo\n```\n\nThe dashboard:\n\n- runs each suite in a separate child process\n- shows `PASS`, `FAIL`, `TIMEOUT`, or `CRASH`\n- captures the full QtTest log in a text pane\n- supports a per-suite timeout from the UI\n\nMain suites include:\n\n- `fifo`\n- `fifo_view`\n- `pool`\n- `pool_view`\n- `latest`\n- `chunk`\n- `queue`\n- `typed_pool`\n- `buffer_pool`\n\n## Latest Test Report (Integrated Run)\n\nRun sources:\n\n- `build/Desktop_Qt_6_10_1_MinGW_64_bit-Debug/bin/debug/spsc_test_shadow_*.exe`\n- `build/Desktop_Qt_6_10_1_MinGW_64_bit-Debug/bin/release/spsc_test_shadow_*.exe`\n\nEnvironment:\n\n- QtTest 6.10.1 / Qt 6.10.1\n- GCC 13.1.0\n- Windows 11\n\nMatrix:\n\n- Debug and Release\n- `shadow_off`, `shadow_on`, `shadow_heur`\n- `fifo`, `fifo_view`, `pool`, `pool_view`, `latest`, `chunk`, `queue`, `typed_pool`, `buffer_pool`\n\nConclusion:\n\n- 54/54 suite runs passed with 30s per-suite timeout.\n- The qmake matrix is a C++17 matrix and forces `SPSC_HAS_SPAN=0`; C++20 `std::span` helpers are intentionally outside this matrix.\n\n## Notes About Death Tests\n\nDebug death tests use child process spawning (`QProcess`).  \nIn restricted environments they can fail with:\n\n- `QProcess: CreateFile failed. (Access is denied.)`\n\nIn a normal local dev environment these tests should pass.\n\n## License\n\nThis project is licensed under the [Apache License 2.0](LICENSE).\n\nFor the core library sources in [`src/spsc`](src/spsc), the license is also marked directly in file headers using `SPDX-License-Identifier: Apache-2.0`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshpegun60%2Fspsc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshpegun60%2Fspsc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshpegun60%2Fspsc/lists"}