Hello,
Method dequeue in QueueRingBuffer can be optimised.
Because read
from RingBuffer
does a check for isEmpty
and returns nil if the buffer is empty.
So, original implementation:
public mutating func dequeue() -> T? {
return isEmpty ? nil : ringBuffer.read()
}
Can be simplified to:
public mutating func dequeue() -> T? {
return ringBuffer.read()
}
Thanks for the great book!
Regards, Sergey