-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
use LockFreeQueue;
use List;
use Time;
config const N = 1024 * 1024 * 16;
var timer = new Timer();
var queue = new owned LockFreeQueue(int);
var l = new list(int, parSafe=true);
timer.start();
forall i in 1..N do queue.enqueue(i);
forall i in 1..N do queue.dequeue();
queue.tryReclaim();
timer.stop();
writeln("LFQ (No Token): ", timer.elapsed());
timer.clear();
timer.start();
forall i in 1..N with (var token = queue.getToken()) do queue.enqueue(i, token);
forall i in 1..N with (var token = queue.getToken()) do queue.dequeue(token);
queue.tryReclaim();
timer.stop();
timer.elapsed();
writeln("LFQ (Token): ", timer.elapsed());
timer.clear();
timer.start();
forall i in 1..N with (ref l) do l.append(i);
forall i in 1..N with (ref l) do l.pop(1);
timer.stop();
writeln("List: ", timer.elapsed());
timer.clear();Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels