Skip to content

Instantly share code, notes, and snippets.

@dinfuehr
Last active October 9, 2018 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dinfuehr/131393f8a72ebefadb001ff0cb7deb47 to your computer and use it in GitHub Desktop.
Save dinfuehr/131393f8a72ebefadb001ff0cb7deb47 to your computer and use it in GitHub Desktop.
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