Created
April 28, 2017 12:22
-
-
Save henryoswald/ddc778773175410af90eac78f9ae57c8 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
async = require("async") | |
Project = require('./app/js/models/Project').Project | |
_ = require("lodash") | |
warmup = "55928319efc30e705817817e" | |
smallproject = "561e86173cfc7400525834a6" | |
twokproject = "5637a97beafc8c7b5bfc487a" | |
fourkproject = "55ef4b39f5e895afbaf2085d" | |
realmassive = "57b1ea8674e706f567b5afe9" | |
twokimageproject = "55ef4b39f5e895afbaf2085f" | |
fourkimageproject = "55ef4b39f5e895afbaf20851" | |
tenRuns = (key, callback)-> | |
findAndTime = (i, cb)-> | |
t = new Date() | |
Project.findById key, (err, project)-> | |
total = new Date()-t | |
cb(null, total) | |
a = [0..10] | |
async.mapSeries a, findAndTime, (err, times)-> | |
result = | |
average: _.sum(times) / a.length | |
times : times | |
callback(null, result) | |
jobs = | |
warmup: (cb)-> | |
tenRuns warmup, cb | |
smallproject: (cb)-> | |
tenRuns smallproject, cb | |
twokproject: (cb)-> | |
tenRuns twokproject, cb | |
fourkproject: (cb)-> | |
tenRuns fourkproject, cb | |
realmassive: (cb)-> | |
tenRuns realmassive, cb | |
twokimageproject: (cb)-> | |
tenRuns twokimageproject, cb | |
fourkimageproject: (cb)-> | |
tenRuns fourkimageproject, cb | |
async.series jobs, (err, results)-> | |
console.log results | |
process.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment