This is a Multi-Producer Single-Consumer queue implementation specific to SBCL x86-64. It is probably one of the fastest of its kind. It implements the beautiful algorithm found at Non-intrusive MPSC node-based queue, and is intended for developing high-performance Actor systems.
Performance comparison with sb-concurrency:queue
(8 producers, 1 consumer, 8M items; iMac Pro (2017), 8 Core Xeon, 32 GB RAM):
FAST-MPSC-QUEUE> (benchmark-fast) Evaluation took: 0.438 seconds of real time 3.127986 seconds of total run time (2.892130 user, 0.235856 system) 714.16% CPU 1,398,546,106 processor cycles 128,508,736 bytes consed NIL FAST-MPSC-QUEUE> (benchmark-sb-concurrency) Evaluation took: 1.650 seconds of real time 14.386185 seconds of total run time (14.321212 user, 0.064973 system) [ Run times consist of 0.002 seconds GC time, and 14.385 seconds non-GC time. ] 871.88% CPU 5,267,885,814 processor cycles 128,292,352 bytes consed NIL
fast-mpsc-queue
is able to process items at 18.2M/s
while sb-concurrency:queue
did 4.8M/s
. That’s lots of speed!