Open stuarthayhurst opened 5 months ago
A single producer, multi consumer queue seems like a decent compromise, since work is realistically only ever going to be submitted from 1 thread, and multiple submits can be batched to avoid taking out the lock multiple times.
Something like https://github.com/MengRao/SPMC_Queue/blob/master/SPMCQueue.h might work
Currently, the engine uses atomic operations for pushes to the work queue, but not for pops. Experiment with a lock-free queue for potentially better performance.