Made sure all segments are evaluated on poll for potentially better throughput (still proof-of-concept - getting better)
This commit is contained in:
parent
597cbd870c
commit
40b1f26c34
@ -66,6 +66,7 @@ public class ConcurrentFastQueue<E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public E poll() {
|
public E poll() {
|
||||||
|
int oldPollIndex = pollIndex;
|
||||||
while (pollIndex < segments.length) {
|
while (pollIndex < segments.length) {
|
||||||
E v = segments[pollIndex].poll();
|
E v = segments[pollIndex].poll();
|
||||||
if (v != null) {
|
if (v != null) {
|
||||||
@ -74,7 +75,14 @@ public class ConcurrentFastQueue<E> {
|
|||||||
|
|
||||||
pollIndex ++;
|
pollIndex ++;
|
||||||
}
|
}
|
||||||
pollIndex = 0;
|
|
||||||
|
for (pollIndex = 0; pollIndex < oldPollIndex; pollIndex ++) {
|
||||||
|
E v = segments[pollIndex].poll();
|
||||||
|
if (v != null) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user