judofyr / spice

Fine-grained parallelism with sub-nanosecond overhead in Zig
BSD Zero Clause License
748 stars 13 forks source link

Global shared job queue #8

Open QuarticCat opened 2 months ago

QuarticCat commented 2 months ago

Currently _popReadyJob takes O(n) time to find the oldest job, which doesn't seem to scale well. I'm wondering if it's better to use a global queue (list) to record all shared jobs. In each heartbeat, the worker enqueues a shared job if it doesn't have a shared job in the queue already. And to pop a ready job, just dequeue.