UNPKG

2.48 kBSource Map (JSON)View Raw
1{"version":3,"sources":["../../src/utils/profile.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sourcesContent":["// const convertHrtime = require(`convert-hrtime`)\n// const _ = require(`lodash`)\n// const treeify = require(`treeify`)\n// const ss = require(`simple-statistics`)\n\n// let root = {\n// ROOT: process.hrtime(),\n// }\n\n// const profile = ({ name, start, parent }) => {\n// const span = convertHrtime(process.hrtime(start))\n// let path = parent ? `${parent}.${name}` : name\n// let currentValue = _.get(root, path)\n// if (_.isObject(currentValue)) {\n// path = `${path}.ROOT`\n// currentValue = _.get(root, path)\n// }\n// const newValue = currentValue\n// ? currentValue + span.milliseconds\n// : span.milliseconds\n// if (name === `run-query`) {\n// console.log({\n// path,\n// span: span.milliseconds,\n// newValue,\n// })\n// }\n// root = _.set(root, path, newValue)\n// }\n\n// global._PROFILE = profile\n// module.exports = profile\n\n// const labelify = (object, rootValue) =>\n// _.mapKeys(object, (value, key, o) => {\n// const currentValue = _.isObject(value) ? value.ROOT : value\n// return `${key}: ${currentValue}ms | ${(\n// (currentValue / rootValue) *\n// 100\n// ).toFixed(2) + `%`}`\n// })\n\n// const descriptiveStats = (array, label) => {\n// if (!array || array.length === 0) return\n// console.log(``)\n// console.log(label)\n// console.log(`count:`, array.length)\n// console.log(`min:`, ss.min(array))\n// console.log(`max:`, ss.max(array))\n// console.log(`mean:`, ss.mean(array))\n// console.log(`quantile 25:`, ss.quantile(array, 0.25))\n// console.log(`quantile 75:`, ss.quantile(array, 0.75))\n// }\n\n// process.on(`exit`, () => {\n// root.ROOT = convertHrtime(process.hrtime(root.ROOT)).milliseconds\n// root = labelify(root, root.ROOT)\n// for (var prop in root) {\n// if (_.isObject(root[prop]) && root[prop].ROOT) {\n// const rootValue = root[prop].ROOT\n// delete root[prop].ROOT\n// root[prop] = labelify(root[prop], rootValue)\n// }\n// }\n// console.log(``)\n// console.log(`===PROFILE===`)\n// console.log(treeify.asTree(root))\n// descriptiveStats(global.promiseMapTimes, `run-sift map nodes`)\n// })\n"],"file":"profile.js"}
\No newline at end of file