Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
richards sampling
function runRichards() {
var scheduler = new Scheduler();
scheduler.addIdleTask(0, null, 1000);
var queue = new Packet();
scheduler.addWorkerTask(1, queue);
if (scheduler.queueCount != 2322) {}
}
function Scheduler() { }
noInline(Scheduler);
Scheduler.prototype.addIdleTask = function (id, queue, count) {
this.addRunningTask(id, queue, new IdleTask(this, 1, count));
};
Scheduler.prototype.addWorkerTask = function (id, queue) {
this.addTask(id, queue, {});
};
Scheduler.prototype.addRunningTask = function (id, queue, task) {
this.addTask(id, queue, task);
};
Scheduler.prototype.addTask = function (id, queue, task) {
new TaskControlBlock(id, queue, task);
};
function TaskControlBlock(id, queue, task) { }
function IdleTask(scheduler) { }
function Packet(link, id, kind) { }
noInline(Packet);
for (var i = 0; i < 20000; ++i) runRichards();
function runRichards() {
var scheduler = new Scheduler();
scheduler.addIdleTask(0, null, 1000);
var queue = new Packet();
scheduler.addWorkerTask(1, queue);
if (scheduler.queueCount != 2322) {}
}
function Scheduler() { }
noInline(Scheduler);
Scheduler.prototype.addIdleTask = function (id, queue, count) {
this.addRunningTask(id, queue, new IdleTask(this, 1, count));
};
Scheduler.prototype.addWorkerTask = function (id, queue) {
this.addTask(id, queue, {});
};
Scheduler.prototype.addRunningTask = function (id, queue, task) {
this.addTask(id, queue, task);
};
Scheduler.prototype.addTask = function (id, queue, task) {
new TaskControlBlock(0, id, queue, task);
};
function TaskControlBlock(link, id, queue, task) { }
function IdleTask(scheduler) { }
function Packet(link, id, kind) { }
noInline(Packet);
for (var i = 0; i < 20000; ++i) runRichards();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment