Created
March 14, 2016 01:38
-
-
Save MiguelCastillo/5c8d604b90a26444ac9c 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
var fs = require("fs"); | |
var mkdirp = require("mkdirp"); | |
var path = require("path"); | |
var chance = require("chance"); | |
function fileStream(dest) { | |
mkdirp.sync(path.dirname(dest)); | |
return fs.createWriteStream(dest); | |
} | |
var http2script = fileStream("./site/http2/test.js"); | |
var items = new Array(1000).fill(0); | |
for (var i = 0, count = 1000; i < count; i++) { | |
fileStream("./site/http2/" + i + ".js").write("console.log(" + i + ");\nmodule.exports='" + chance().paragraph({ sentences: 50 }) + "';"); | |
items[i] = "./http2/" + i; | |
} | |
var imports = JSON.stringify(items); | |
http2script.write("var start = Date.now();\nSystem\n\t.fetchOnly(" + imports + ")\n\t.then(function() { var end = Date.now(); console.log('elapsed', (end - start)/1000); });"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment