Skip to content

feat: add drogalis SPSC-Queue as benchmark contender - #13

Merged
Milerius merged 3 commits into
mainfrom
feat/drogalis-spsc-contender
Mar 27, 2026
Merged

Milerius merged 3 commits into
mainfrom
feat/drogalis-spsc-contender

Conversation

@Milerius

Copy link
Copy Markdown
Owner

Summary

  • Add drogalis/SPSC-Queue (C++20, header-only, MIT) as a benchmark contender alongside rigtorp
  • Vendor dro/spsc-queue.hpp header, add FFI bridge (same pattern as rigtorp)
  • Add -march=native to both C++ contender builds for fair comparison
  • Benchmark single, burst_100, burst_1000 for u64/msg48/msg64

Local results (Apple M4 Pro)

Queue single/u64 single/msg48 single/msg64 burst_100/u64 burst_1000/u64
mantis copy 1.94 ns 4.19 ns 5.31 ns 123.95 ns 1.34 µs
mantis inline 2.26 ns 6.61 ns 8.86 ns 259.95 ns 2.82 µs
drogalis 2.33 ns 5.06 ns 6.53 ns 525.22 ns 5.92 µs
rtrb 2.57 ns 5.02 ns 6.83 ns 356.93 ns 3.51 µs
rigtorp 2.72 ns 4.86 ns 6.61 ns 494.73 ns 5.23 µs
crossbeam 4.18 ns 5.82 ns 7.26 ns 541.33 ns 6.04 µs

Test plan

  • CI builds with bench-contenders-cpp feature
  • Benchmark runs on CI (Linux x86_64) to get cross-platform numbers
  • Verify C++20 support on CI compiler

🤖 Generated with Claude Code

Add dro::SPSCQueue (C++20, header-only) alongside rigtorp as a C++
benchmark contender behind the existing bench-contenders-cpp feature
flag.

- Vendor dro/spsc-queue.hpp header (MIT licensed)
- Add drogalis_ffi.cpp/rs FFI bridge (same pattern as rigtorp)
- Add -march=native to both C++ contender builds
- Benchmark single, burst_100, burst_1000 for u64/msg48/msg64

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Milerias and others added 2 commits March 27, 2026 15:25
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Without this, drogalis results fall into the "other" bucket
and don't appear in the CI comparison tables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Mar 27, 2026 •

Copy link
Copy Markdown

Benchmark Report

Commit: ffbce63d520a207a4b032379531cf3805112ef40

Linux

CPU: AMD EPYC 7763 64-Core Processor | Arch: x86_64 | Compiler: rustc 1.96.0-nightly (23903d01c 2026-03-26)

Latency (ns/op, lower is better)

Single Push+Pop

Element crossbeam drogalis-cpp mantis/copy mantis/general mantis/inline rigtorp-cpp rtrb
msg48 23.13 10.15 9.37 🏆 31.64 31.59 9.88 21.32
msg64 7.88 6.04 3.7 🏆 16.62 16.61 6.03 6.19
u64 5.5 4.37 2.5 🏆 - 3.76 4.44 3.86

Burst 100

Element crossbeam drogalis-cpp mantis/copy mantis/inline rigtorp-cpp rtrb
msg48 3007.09 1840.39 217.01 🏆 2592.69 1835.54 2450.38
msg64 1040.07 762.03 233.16 🏆 1464 825.18 767.28
u64 835.95 385.94 168.16 🏆 343.61 448.25 340.98

Burst 1000

Element crossbeam drogalis-cpp mantis/copy mantis/inline rigtorp-cpp rtrb
msg48 29995.35 18578.61 2132.82 🏆 26180.88 17771.47 23699.33
msg64 11546.98 7678.51 2205.56 🏆 14634.18 8164.69 7564.77
u64 8049.37 3447.38 1601.77 🏆 3436.87 4070.99 3017.2

Batch 100

Element mantis/copy
msg48 72.47 🏆
u64 15.41 🏆

Batch 1000

Element mantis/copy
msg48 991.37 🏆
u64 113.21 🏆

Full Drain

Element mantis/inline
u64 2028.57 🏆
Instructions per Op (lower is better)
Full results (all fields)
Workload ns/op p50 p99 cycles insns bmiss l1d llc
spsc/inline/single_item/u64 3.76 3.7 3.9 11.9 - - - -
spsc/inline/single_item/msg48 31.59 31.6 31.8 107.3 - - - -
spsc/inline/single_item/msg64 16.61 16.6 16.8 57.3 - - - -
spsc/inline/burst_100/u64 343.61 343 352.6 1457.4 - - - -
spsc/inline/burst_100/msg48 2592.69 2587.5 2648.4 10823 - - - -
spsc/inline/burst_100/msg64 1464 1463.1 1483.9 4440.3 - - - -
spsc/inline/burst_1000/u64 3436.87 3426.3 3573.6 11459.9 - - - -
spsc/inline/burst_1000/msg48 26180.88 26167.4 26338.7 87908.1 - - - -
spsc/inline/burst_1000/msg64 14634.18 14624.1 14730.6 51372 - - - -
spsc/inline/full_drain/u64 2028.57 2023 2113.2 7294.1 - - - -
copy/single/u64 2.5 2.5 2.5 9.5 - - - -
copy/single/msg48 9.37 9.4 9.4 34.6 - - - -
copy/single/msg64 3.7 3.7 3.7 11.6 - - - -
general/single/msg48 31.64 31.6 31.9 107.2 - - - -
general/single/msg64 16.62 16.6 16.7 57.3 - - - -
copy/burst/100/u64 168.16 167.8 171.3 694.7 - - - -
copy/burst/100/msg48 217.01 216.7 220.4 693.5 - - - -
copy/burst/100/msg64 233.16 232.7 239.8 755 - - - -
copy/burst/1000/u64 1601.77 1593.3 1688.1 5059.5 - - - -
copy/burst/1000/msg48 2132.82 2130.1 2168.2 7916.4 - - - -
copy/burst/1000/msg64 2205.56 2198.7 2295.1 8365.5 - - - -
copy/batch/100/u64 15.41 15.4 15.6 43.2 - - - -
copy/batch/100/msg48 72.47 72.3 74.9 272.3 - - - -
copy/batch/1000/u64 113.21 113.1 114.3 371.7 - - - -
copy/batch/1000/msg48 991.37 990.9 997.6 3494.6 - - - -
spsc/rtrb/single_item/u64 3.86 3.8 4.1 12.5 - - - -
spsc/rtrb/single_item/msg48 21.32 20.7 23.5 82.8 - - - -
spsc/rtrb/single_item/msg64 6.19 5.8 7.3 17.6 - - - -
spsc/rtrb/burst_100/u64 340.98 336.3 365.2 1401 - - - -
spsc/rtrb/burst_100/msg48 2450.38 2480.5 2623.1 9907.5 - - - -
spsc/rtrb/burst_100/msg64 767.28 822.9 924.8 2616.8 - - - -
spsc/rtrb/burst_1000/u64 3017.2 3012.8 3064.6 9387.4 - - - -
spsc/rtrb/burst_1000/msg48 23699.33 23922.3 25595.3 75710.5 - - - -
spsc/rtrb/burst_1000/msg64 7564.77 7254.3 8491.9 25428.2 - - - -
spsc/crossbeam/single_item/u64 5.5 5.5 5.6 22.3 - - - -
spsc/crossbeam/single_item/msg48 23.13 23.1 23.3 65.4 - - - -
spsc/crossbeam/single_item/msg64 7.88 7.9 8 26.2 - - - -
spsc/crossbeam/burst_100/u64 835.95 835.6 840.3 2679.7 - - - -
spsc/crossbeam/burst_100/msg48 3007.09 3006.9 3015.9 9346.7 - - - -
spsc/crossbeam/burst_100/msg64 1040.07 1044 1056.7 3798.3 - - - -
spsc/crossbeam/burst_1000/u64 8049.37 8046.5 8094.5 29566.5 - - - -
spsc/crossbeam/burst_1000/msg48 29995.35 29976.9 30232.8 106590.5 - - - -
spsc/crossbeam/burst_1000/msg64 11546.98 11555.5 11678.2 36102 - - - -
spsc/rigtorp/single_item/u64 4.44 4.4 4.6 15.7 - - - -
spsc/rigtorp/single_item/msg48 9.88 9.9 10.3 38.8 - - - -
spsc/rigtorp/single_item/msg64 6.03 6.2 6.6 16.2 - - - -
spsc/rigtorp/burst_100/u64 448.25 447.8 455 1475.4 - - - -
spsc/rigtorp/burst_100/msg48 1835.54 1789 2062.9 5922.8 - - - -
spsc/rigtorp/burst_100/msg64 825.18 857.4 1304.1 2777.1 - - - -
spsc/rigtorp/burst_1000/u64 4070.99 4062 4202.2 14844.1 - - - -
spsc/rigtorp/burst_1000/msg48 17771.47 17191.1 20302.5 67377.9 - - - -
spsc/rigtorp/burst_1000/msg64 8164.69 6719.6 12531.3 24519.8 - - - -
spsc/drogalis/single_item/u64 4.37 4.4 4.4 15.3 - - - -
spsc/drogalis/single_item/msg48 10.15 10.1 10.4 40.3 - - - -
spsc/drogalis/single_item/msg64 6.04 6.2 6.6 16.4 - - - -
spsc/drogalis/burst_100/u64 385.94 385.6 390.6 1171.9 - - - -
spsc/drogalis/burst_100/msg48 1840.39 1792.5 2063.6 6123.7 - - - -
spsc/drogalis/burst_100/msg64 762.03 823.3 956.9 2547.7 - - - -
spsc/drogalis/burst_1000/u64 3447.38 3441.9 3517.4 11479.7 - - - -
spsc/drogalis/burst_1000/msg48 18578.61 18076.5 20869 72600.7 - - - -
spsc/drogalis/burst_1000/msg64 7678.51 6991.1 9383.4 24630 - - - -
macOS

CPU: Apple M1 (Virtual) | Arch: aarch64 | Compiler: rustc 1.96.0-nightly (23903d01c 2026-03-26)

Latency (ns/op, lower is better)

Single Push+Pop

Element crossbeam drogalis-cpp mantis/copy mantis/general mantis/inline rigtorp-cpp rtrb
msg48 10.63 10.32 8.78 🏆 9.7 12.56 10.76 9.04
msg64 11.35 10.11 7.93 🏆 10.86 13.48 10.41 10.09
u64 9.03 8.66 6.75 🏆 - 9.07 9.18 7.08

Burst 100

Element crossbeam drogalis-cpp mantis/copy mantis/inline rigtorp-cpp rtrb
msg48 1841.51 1805.27 338.52 🏆 528.83 1826.1 764.14
msg64 1911.79 1756.02 416.94 🏆 639.88 1899.38 812.78
u64 1752.84 1610.15 303.01 292.88 🏆 1620.51 644.27

Burst 1000

Element crossbeam drogalis-cpp mantis/copy mantis/inline rigtorp-cpp rtrb
msg48 21137.74 19446.52 4426.18 🏆 6211.29 19153.45 7899.7
msg64 19413.23 32714.93 5088.23 🏆 7366.32 33667.67 21537.54
u64 18371.46 15692.4 3422.4 2765.64 🏆 16149.38 7048.75

Batch 100

Element mantis/copy
msg48 96.77 🏆
u64 24.09 🏆

Batch 1000

Element mantis/copy
msg48 798.68 🏆
u64 134.98 🏆

Full Drain

Element mantis/inline
u64 4290.52 🏆
Instructions per Op (lower is better)
Full results (all fields)
Workload ns/op p50 p99 cycles insns bmiss l1d llc
spsc/inline/single_item/u64 9.07 8.9 10.7 0.3 - - - -
spsc/inline/single_item/msg48 12.56 12.4 16.8 0.4 - - - -
spsc/inline/single_item/msg64 13.48 12.7 20.3 0.4 - - - -
spsc/inline/burst_100/u64 292.88 272 406.3 10.7 - - - -
spsc/inline/burst_100/msg48 528.83 528.6 567 20.6 - - - -
spsc/inline/burst_100/msg64 639.88 638.1 679.8 26.6 - - - -
spsc/inline/burst_1000/u64 2765.64 2638.2 3634.6 88.9 - - - -
spsc/inline/burst_1000/msg48 6211.29 5994.8 7868.6 185.8 - - - -
spsc/inline/burst_1000/msg64 7366.32 7368.5 8044.9 257.5 - - - -
spsc/inline/full_drain/u64 4290.52 4140.1 5195 153.7 - - - -
copy/single/u64 6.75 6.7 7.5 0.2 - - - -
copy/single/msg48 8.78 8.5 10.9 0.3 - - - -
copy/single/msg64 7.93 7.9 8.5 0.3 - - - -
general/single/msg48 9.7 9.7 10.6 0.4 - - - -
general/single/msg64 10.86 11 12.5 0.3 - - - -
copy/burst/100/u64 303.01 292.3 360.3 11.6 - - - -
copy/burst/100/msg48 338.52 336.5 380.1 14.5 - - - -
copy/burst/100/msg64 416.94 409.4 485.1 12.5 - - - -
copy/burst/1000/u64 3422.4 3398.5 3599.1 115.2 - - - -
copy/burst/1000/msg48 4426.18 4368.8 5291.5 158.5 - - - -
copy/burst/1000/msg64 5088.23 4947.3 5809.9 208.8 - - - -
copy/batch/100/u64 24.09 23.7 29.3 0.7 - - - -
copy/batch/100/msg48 96.77 96.2 117.6 2.9 - - - -
copy/batch/1000/u64 134.98 131.8 159.1 4.6 - - - -
copy/batch/1000/msg48 798.68 799.8 864.2 26 - - - -
spsc/rtrb/single_item/u64 7.08 7 7.5 0.2 - - - -
spsc/rtrb/single_item/msg48 9.04 8.9 9.6 0.3 - - - -
spsc/rtrb/single_item/msg64 10.09 9.9 10.8 0.4 - - - -
spsc/rtrb/burst_100/u64 644.27 638.8 713.3 27.6 - - - -
spsc/rtrb/burst_100/msg48 764.14 756.1 850.8 23.6 - - - -
spsc/rtrb/burst_100/msg64 812.78 804.1 883.3 24 - - - -
spsc/rtrb/burst_1000/u64 7048.75 6920.8 8056.8 232 - - - -
spsc/rtrb/burst_1000/msg48 7899.7 7715.2 8892 292.9 - - - -
spsc/rtrb/burst_1000/msg64 21537.54 21484.4 23504.8 938.2 - - - -
spsc/crossbeam/single_item/u64 9.03 8.8 10.4 0.3 - - - -
spsc/crossbeam/single_item/msg48 10.63 10.6 11.4 0.4 - - - -
spsc/crossbeam/single_item/msg64 11.35 11.2 12.2 0.5 - - - -
spsc/crossbeam/burst_100/u64 1752.84 1742 1980.6 56.5 - - - -
spsc/crossbeam/burst_100/msg48 1841.51 1816.7 1989.8 61.5 - - - -
spsc/crossbeam/burst_100/msg64 1911.79 1878.5 2169.3 66.3 - - - -
spsc/crossbeam/burst_1000/u64 18371.46 18001.9 22191.7 680.7 - - - -
spsc/crossbeam/burst_1000/msg48 21137.74 20987.4 25250.2 838.4 - - - -
spsc/crossbeam/burst_1000/msg64 19413.23 19234 21500.9 793.4 - - - -
spsc/rigtorp/single_item/u64 9.18 8.9 10.7 0.3 - - - -
spsc/rigtorp/single_item/msg48 10.76 10.4 13.1 0.4 - - - -
spsc/rigtorp/single_item/msg64 10.41 10.2 12.7 0.4 - - - -
spsc/rigtorp/burst_100/u64 1620.51 1619 1793.3 50.5 - - - -
spsc/rigtorp/burst_100/msg48 1826.1 1830.7 1930.1 61.7 - - - -
spsc/rigtorp/burst_100/msg64 1899.38 1854 2118.3 64.2 - - - -
spsc/rigtorp/burst_1000/u64 16149.38 16212.5 16966.8 587 - - - -
spsc/rigtorp/burst_1000/msg48 19153.45 18967.2 20304.1 755 - - - -
spsc/rigtorp/burst_1000/msg64 33667.67 33330.2 37221.2 1248.1 - - - -
spsc/drogalis/single_item/u64 8.66 8.7 9.2 0.3 - - - -
spsc/drogalis/single_item/msg48 10.32 10.2 11.5 0.4 - - - -
spsc/drogalis/single_item/msg64 10.11 9.9 11.4 0.4 - - - -
spsc/drogalis/burst_100/u64 1610.15 1544.1 2059.9 49.3 - - - -
spsc/drogalis/burst_100/msg48 1805.27 1807.6 1949 71.9 - - - -
spsc/drogalis/burst_100/msg64 1756.02 1749.4 1920 56.5 - - - -
spsc/drogalis/burst_1000/u64 15692.4 15679 16829.8 555.6 - - - -
spsc/drogalis/burst_1000/msg48 19446.52 19370.6 20297.9 815.2 - - - -
spsc/drogalis/burst_1000/msg64 32714.93 32626.6 35418.4 1198.6 - - - -

@Milerius
Milerius merged commit 1f4d2a3 into main Mar 27, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants