Skip to content

Instantly share code, notes, and snippets.

@bobrik
Created August 26, 2012 14:28
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 bobrik/3480218 to your computer and use it in GitHub Desktop.
Save bobrik/3480218 to your computer and use it in GitHub Desktop.
// /mnt/sdd/testfile is 4Gb file
// we read this file in 50 "threads"
// node.js results: ~1700 ops/s 7 Mb/s
// randomio results: ~290 ops/s 19 Mb/s
var fs = require("fs"),
fd = fs.openSync("/mnt/sdd/testfile", "r"),
i = 0,
l = 1204 * 64;
for (; i < 50; i++) {
check();
}
function check() {
var o = Math.random() * 1024 * 3500000,
b = new Buffer(l);
console.log("another read");
fs.read(fd, b, 0, l, o, check);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment