Search code examples
goqueuefifo

Is there a queue implementation?


Can anyone suggest Go container for simple and fast FIFO/queue, Go has 3 different containers: heap, list and vector. Which one is more suitable to implement a queue?


Solution

  • Either vector or list should work, but vector is probably the way to go. I say this because vector will probably allocate less often than list and garbage collection (in the current Go implementation) is fairly expensive. In a small program it probably won't matter, though.