{"name":"estimo","version":"0.1.5","description":"Generate Big Rig reports for js libs","main":"index.js","scripts":{"eslint":"eslint --cache src","test":"ava"},"dependencies":{"@condenast/perf-timeline-cli":"^0.1.3","bigrig":"^1.3.0","nanoid":"^2.0.1","yargs":"^13.2.2"},"devDependencies":{"ava":"^1.4.1","eslint":"^5.16.0","eslint-config-airbnb":"^17.1.0","eslint-plugin-import":"^2.17.1","husky":"^1.3.1","lint-staged":"^8.1.5"},"engines":{"node":">=8.9.0"},"preferGlobal":true,"bin":{"estimo":"./cli.js"},"ava":{"files":["test/**/*.js","!test/__mock__/**"]},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.(js)":["yarn eslint","git add"]},"repository":{"type":"git","url":"git+https://github.com/mbalabash/estimo.git"},"homepage":"https://github.com/mbalabash/estimo#readme","bugs":{"url":"https://github.com/mbalabash/estimo/issues"},"keywords":["bigrig","chrome","devtools","size-limit","performance","js"],"author":{"name":"mbalabash","email":"maksim.balabash@gmail.com"},"license":"MIT","gitHead":"2637faa70eff5772ec0a03bfe8ee316d54973a6e","_id":"estimo@0.1.5","_nodeVersion":"11.4.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-rcZLcYOyYXXgq6lJWaICwB/nLYIH2oUMhqASdtmdpGh6U2D9CyRm46aoCJoj7QIs+NxeZNfYZ2xQWnt47DkM5g==","shasum":"35aa25b36fcd2b654f41993ebe348dc01440ae59","tarball":"http://registry-npm.ywwl.com/estimo/download/estimo-0.1.5.tgz","fileCount":18,"unpackedSize":23515,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJctzr4CRA9TVsSAnZWagAAqOEQAJQlQ8L2Ey6V7sTZ7v5v\na/iIxiZ7sCu9z9v0ncjMVwF3MkCrwa/JGu9fkaE7/9elulXqELW1fGYu0tkT\n2Wqv/mv2lA7xFYpDCGOxoJ/qpYW1VgImD4jW8C9ZfnGtycRTJ4GqnnCP9t+R\nyKH08JJnJsRbrhEauL1NaAMboJh5fMcKz2H1D+IdeBxAWnMPnXvuVI1Nu0bS\nYAQm1bYrK9SfjnO1+qHNAP3Ce4rpdGE//Ps9c8t47e/ZU1z/do6ZnJIptTpj\n1la8v0l5mrBRmwsj4/WOYOW4TfUSMk+zH9gzlB6NBiDgV5smI1klaBnXxSN0\n9ThLls+/Hr6CQgFRL6xAA2HzCW0zGsNn548jQeAKLKaUGq24EkNkS1kkGpNZ\nMpUT0I/7S/zDgZfg920wGFLJFcapP8O1KTSySOSMBXeSo6pIHbTKIgQi3Qg+\nAkC/RHxFc/KF6k1/kZEnCHRjUlW+0EL157UmIMlZUhSXf/Ozs4nBGx3I45WE\nP7ty7ok7ivmfaYpHOWphgHpc0bbGQdX6TUpsu9f1ZU1Qdx/OdnQ+B3LrrumV\nU3X5WkJSI+X0hnCWyOwrHwfdT9IX7TanDu/OEqDVqaGMt/oCwpAPT+5fLUC3\nlmqMSqqsyDLd3bH0Er8cbvdgL4tBfsw7pCiiiTNhrymOuMrPubrLiSBlz8wn\nVpwu\r\n=IaCM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH3Y9miSUotHxkLiRwi0GgHXTc+/3ff00ooBCwl9e2chAiB4dYz8ryLSiNaPeTXBtwvK5SE1qv7pvjbMIKtnGUhViw=="}],"size":6665,"noattachment":false,"key":"/estimo/-/estimo-0.1.5.tgz"},"maintainers":[{"name":"mbalabash","email":"maksim.balabash@gmail.com"}],"_npmUser":{"name":"mbalabash","email":"maksim.balabash@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/estimo_0.1.5_1555512055510_0.7288627651877753"},"_hasShrinkwrap":false,"readme":"## Estimo\n\nEstimo is a tool for measuring parse / compile / execution time of javascript.\n\nThis tool can emulate CPU throttling, Network conditions, use Chrome Device emulation and more for measuring javascript performance.\n\n_Inspired by [Size Limit](https://github.com/ai/size-limit). Thanks [@ai](https://github.com/ai/) and [@aslushnikov](https://github.com/aslushnikov) for support._\n\n## Why?\n\n**JavaScript** is the **most expensive part** of our frontend.\n\n![3.5 seconds to process 170 KB of JS and 0.1 second for 170 KB of JPEG. @Addy Osmani](https://cdn.evilmartians.com/front/posts/storeon-redux-in-173-bytes/js_vs_jpeg-85dbf5c.png)\n\n**3.5 seconds** to process 170 KB of JS and **0.1 second** for 170 KB of JPEG.\n\n## Usage\n\n**JS API**\n\n```js\nconst path = require('path')\nconst estimo = require('estimo')\n\n;(async () => {\n  const report = await estimo(path.join(__dirname, 'examples', 'example.js'))\n  console.log(report)\n})()\n```\n\n**CLI**\n\n```sh\nestimo -r ./examples/example.js\n```\n\n**Output**\n\n```js\n;[\n  {\n    name: 'example.js',\n    parseHTML: 1.01,\n    styleLayout: 34.08,\n    paintCompositeRender: 1.4,\n    scriptParseCompile: 1.04,\n    scriptEvaluation: 8.11,\n    javaScript: 9.15,\n    garbageCollection: 0,\n    other: 8.2,\n    total: 53.84\n  }\n]\n```\n\n## Fields Description\n\n- **name** - Resource name (file name or web url).\n\n- **parseHTML** - Time which was spent for `ParseHTML`, `ParseAuthorStyleSheet` events.\n\n- **styleLayout** - Time which was spent for `ScheduleStyleRecalculation`, `UpdateLayoutTree`, `InvalidateLayout`, `Layout` events.\n\n- **paintCompositeRender** - Time which was spent for `Animation`, `HitTest`, `PaintSetup`, `Paint`, `PaintImage`, `RasterTask`, `ScrollLayer`, `UpdateLayer`, `UpdateLayerTree`, `CompositeLayers` events.\n\n- **scriptParseCompile** - Time which was spent for `v8.compile`, `v8.compileModule`, `v8.parseOnBackground` events.\n\n- **scriptEvaluation** - Time which was spent for `EventDispatch`, `EvaluateScript`, `v8.evaluateModule`, `FunctionCall`, `TimerFire`, `FireIdleCallback`, `FireAnimationFrame`, `RunMicrotasks`, `V8.Execute` events.\n\n- **javaScript** - Time which was spent for both event groups (**scriptParseCompile** and **scriptEvaluation**).\n\n- **garbageCollection** - Time which was spent for `MinorGC`, `MajorGC`, `BlinkGC.AtomicPhase`, `ThreadState::performIdleLazySweep`, `ThreadState::completeSweep`, `BlinkGCMarking` events.\n\n- **other** - Time which was spent for `MessageLoop::RunTask`, `TaskQueueManager::ProcessTaskFromWorkQueue`, `ThreadControllerImpl::DoWork` events.\n\n- **total** - Total time.\n\n## Time\n\n**All metrics are in milliseconds**.\n\nWe measure system-cpu time. The number of seconds that the process has spent on the CPU.\n\nWe not including time spent waiting for its turn on the CPU.\n\n## Multiple Runs\n\nAll results measured in time. It means that results could be unstable depends on available on your device resources.\n\nYou can use `runs` option to run estimo N times and get median value as a result.\n\n**JS API**\n\n```js\nconst report = await estimo(['/path/to/examples/example.js'], { runs: 10 })\n```\n\n**CLI**\n\n```sh\nestimo -r /path/to/examples/example.js -runs 10\n```\n\n## Diff Mode\n\nYou can compare metrics of an origin file with others its versions to understand consequences on performance.\n\nWe take the first file as a baseline. All rest files will be compared with the baseline.\n\n**JS API**\n\n```js\nconst report = await estimo(['lib-1.0.5.js', 'lib-1.1.0.js'], { diff: true })\n```\n\n**CLI**\n\n```sh\nestimo -r lib-1.0.5.js lib-1.1.0.js -diff\n```\n\n**Output**\n\n```js\n;[\n  {\n    name: 'lib-1.0.5.js',\n    parseHTML: 1.48,\n    styleLayout: 44.61,\n    paintCompositeRender: 2.19,\n    scriptParseCompile: 1.21,\n    scriptEvaluation: 9.63,\n    javaScript: 10.84,\n    garbageCollection: 0,\n    other: 9.95,\n    total: 69.06\n  },\n  {\n    name: 'lib-1.1.0.js',\n    parseHTML: 2.97,\n    styleLayout: 61.02,\n    paintCompositeRender: 2.11,\n    scriptParseCompile: 2.11,\n    scriptEvaluation: 19.28,\n    javaScript: 21.39,\n    garbageCollection: 0,\n    other: 15.49,\n    total: 102.98,\n    diff: {\n      parseHTML: '2.97 (+50.17% 🔺)',\n      styleLayout: '61.02 (+26.9% 🔺)',\n      paintCompositeRender: '2.11 (-3.8% 🔽)',\n      scriptParseCompile: '2.11 (+42.66% 🔺)',\n      scriptEvaluation: '19.28 (+50.06% 🔺)',\n      javaScript: '21.39 (+49.33% 🔺)',\n      garbageCollection: '0 (N/A)',\n      other: '15.49 (+35.77% 🔺)',\n      total: '102.98 (+32.94% 🔺)'\n    }\n  }\n]\n```\n\n## Additional Use Cases\n\n### CPU Throttling Rate\n\nThe CPU Throttling Rate Emulation allows you to simulate CPU performance.\n\n- **cpuThrottlingRate** (default: `1`) - Sets the CPU throttling rate. The number represents the slowdown factor (e.g., 2 is a \"2x\" slowdown).\n\n**JS API**:\n\n```js\nawait estimo('/path/to/example.js', { cpuThrottlingRate: 4 })\n```\n\n**CLI**:\n\n```sh\nestimo -r ./examples/example.js -cpu 4\n```\n\n### Network Emulation\n\nThe Network Emulation allows you to simulate a specified network conditions.\n\n- **emulateNetworkConditions** (default: `undefined`) - One of [puppeteer network conditions descriptor](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-puppeteernetworkconditions).\n\n**JS API**:\n\n```js\nawait estimo('/path/to/example.js', { emulateNetworkConditions: 'Slow 3G' })\n```\n\n**CLI**:\n\n```sh\nestimo -r ./examples/example.js -net Slow\\ 3G\n```\n\n### Chrome Device Emulation\n\nThe Chrome Device Emulation allow you to simulate a specified device conditions.\n\n- **device** (default: `undefined`) - One of [puppeteer devices descriptor](https://pptr.dev/#?product=Puppeteer&version=v11.0.0&show=api-puppeteerdevices).\n\n**JS API**\n\n```js\nconst report = await estimo('/path/to/example.js', { device: 'Galaxy S5' })\n```\n\n**CLI**\n\n```sh\nestimo -r ./examples/examples.js -device Galaxy\\ S5\n```\n\nWhen using CLI, for device names with spaces you should use symbols escaping.\n\n### Changing default timeout\n\nYou can specify how long estimo should wait for page to load.\n\n- **timeout** (default: `20000`) - Sets timeout in ms.\n\n**JS API**:\n\n```js\nawait estimo('/path/to/example.js', { timeout: 90000 })\n```\n\n**CLI**:\n\n```sh\nestimo -r ./examples/example.js -timeout 90000\n```\n\n### Multiple Resources\n\n**JS API**\n\n```js\nconst report = await estimo([\n  '/path/to/libs/example.js',\n  '/path/to/another/example/lib.js'\n])\n```\n\n**CLI**\n\n```sh\nestimo -r /path/to/example.js https://unpkg.com/react@16/umd/react.development.js\n```\n\n### Pages\n\nYou can use all features not only with js files, but with web pages too.\n\nWe will wait for navigation to be finished when the `load` event is fired.\n\n**JS API**\n\n```js\nconst report = await estimo('https://www.google.com/')\n```\n\n**CLI**\n\n```sh\nestimo -r https://www.google.com/\n```\n\n## Install\n\n```js\nnpm i estimo\n```\n\nor\n\n```js\nyarn add estimo\n```\n\n## How?\n\nIt uses [puppeteer](https://github.com/GoogleChrome/puppeteer) to generate Chrome Timelines. Which can be transformed in human-readable shape by [Tracium](https://github.com/aslushnikov/tracium).\n\nWe will use your local **Chrome** if it suitable for using with Estimo.\n\n**Keep in mind** there result depends on your device and available resources.\n\n## Who Uses Estimo\n\n- [Size Limit](https://github.com/ai/size-limit)\n\n## Contributing\n\nPull requests, feature ideas and bug reports are very welcome. We highly appreciate any feedback.\n","publish_time":1555512055629,"_cnpm_publish_time":1555512055629,"dist-tags":{"latest":"3.0.3"}}