github.com/egonelbre/exp@v0.0.0-20240430123955-ed1d3aa93911/queues/README.md (about)

     1  Go Queues Test
     2  ==
     3  
     4  Performance test of different concurrent queue implementations
     5  
     6  --
     7  
     8  Warning: not for production use!
     9  
    10  -- 
    11  
    12  Available Structure:
    13  
    14  * CFifo : Channel based fifo
    15  * LcLifo : list.List based lifo using chan for locking
    16  * LcFifo : list.List based fifo using chan for locking
    17  * LmLifo : list.List based lifo using mutex for locking
    18  * LmFifo : list.List based fifo using mutex for locking
    19  * ZLifo : lockfree lifo implementation (broken, ABA problem)
    20  * ZFifo : lockfree fifo implementation (probably broken)
    21  * ZcFifo : lockfree fifo implementation using chan based freelist (crashes)
    22  * ZrFifo : lockfree fifo implementation using ring.Ring based freelist (probably broken)
    23  * RmLifo : ring.Ring based lifo using mutex for locking
    24  * RmFifo : ring.Ring based fifo using mutex for locking
    25  * SmLifo : slice based lifo using mutex for locking
    26  * SmFifo : slice based fifo using mutex for locking
    27  
    28  Tests:
    29  
    30  1. Single threaded
    31  2. Add N, Remove N
    32  3. N times (Add 1, Remove 1)
    33  4. N/2 times (Add 2, Remove 1), Remove N/2
    34  5. Add N/2, N/2 times (Add 1, Remove 2)
    35  
    36  ZcFifo was excluded due to crash.
    37  
    38  General recommendation use chan if it suits otherwise use slice + "chan as a lock".