Created
October 1, 2018 14:48
-
-
Save te-online/83cee84d40492ca1f64cda50b6bd93c3 to your computer and use it in GitHub Desktop.
Node Performance measurement for laymen
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
const start = now(); | |
// some task goes here | |
const end = now(); | |
const time = (end-start).toFixed(4); | |
const currentList = process.env.PERFLIST; | |
const list = (currentList) ? JSON.parse(currentList) : []; | |
list.push(time); | |
process.env.PERFLIST = JSON.stringify(list); | |
list.sort(); | |
console.log("current median:", list[Math.ceil(list.length / 2)], "with n:", list.length); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment