Created
August 26, 2012 14:28
-
-
Save bobrik/3480218 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// /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