{"name":"estimo","version":"2.3.4","description":"Evaluates how long the browser will execute your javascript code","main":"index.js","types":"./index.d.ts","engines":{"node":">=12"},"license":"MIT","author":{"name":"mbalabash","email":"maksim.balabash@gmail.com"},"scripts":{"unit":"ava --timeout=4m --exit","test":"eslint . && check-dts && yarn unit","clean":"rimraf ./temp/*.{html,json} && node ./scripts/clean-chrome-config.js"},"bin":{"estimo":"scripts/cli.js"},"dependencies":{"@sitespeed.io/tracium":"^0.3.3","commander":"^9.0.0","find-chrome-bin":"0.1.0","nanoid":"^3.3.1","puppeteer-core":"^13.4.0"},"devDependencies":{"@logux/eslint-config":"^46.1.1","ava":"3.x.x","check-dts":"^0.6.6","eslint":"^8.10.0","eslint-config-standard":"^16.0.3","eslint-plugin-import":"^2.25.4","eslint-plugin-node":"^11.1.0","eslint-plugin-prefer-let":"^3.0.1","eslint-plugin-promise":"^6.0.0","prettier":"^2.5.1","rimraf":"^3.0.2","typescript":"^4.5.5"},"eslintConfig":{"extends":"@logux/eslint-config","rules":{"no-console":"off"}},"eslintIgnore":["tests/__mock__/*.js","README.md"],"ava":{"concurrency":1,"files":["tests/**/*.js","!tests/__mock__/**"]},"prettier":{"arrowParens":"avoid","quoteProps":"as-needed","semi":false,"singleQuote":true,"trailingComma":"none"},"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"},"preferGlobal":true,"keywords":["chrome","tracium","puppeteer","devtools","size-limit","performance"],"gitHead":"135d9f31fc664d8f7e34f7b7accb23d963b55909","_id":"estimo@2.3.4","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-jPjaCeuPoAkKhPf8Tg7ITanQd0deMuZz6hvdhaq/pQkqFK2iYrYggMNvCrbGTPY1N6fdMmtvKVDAoEsjOz781Q==","shasum":"8bd797890614cbc71b579b54103b91ccc197d2ad","tarball":"http://registry-npm.ywwl.com/estimo/download/estimo-2.3.4.tgz","fileCount":33,"unpackedSize":439230,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiG7gxACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpLTBAAlwDNKi6jbLu+E0HzQJiSNQDAx7R/rpBURw1h5ZqjDdQzP0N0\r\nMb0HUVoZnfCAP7GdSrK6XNEW2ydhuhdeNgdh4JFrEzHQa+29gsurMd+b5EQh\r\npacXSaYJkQ3N4flSGRTgTmu/CRXwutLT+FQLAxmHzJz+Xf6eLLx+lLxn83rB\r\nmKfzpfwurPxTb7ZVHgYi2CkS5V/eDVM0CSAHekybPUgsr8jDVxRuEPjgS6CC\r\na4MIXYKfb6H/FXD4mDttFh+xS1CGhod1xKFWT44CI/KvGeLXvx/I6BtINxom\r\n6HEjEcuqqzhrbcUlJWdL0rv/Yr95WkKKdYFF3OF4QcAIDbzKd3nsWSwSi87j\r\nj2RfNyFe/TG3MAjq6SAtzRBpz7EyDtS58KDB9d9qYVVXkm42ZjB0uIjuHY7L\r\njBHZj3rQ02YfFP1rHyHnU+Dd0QA5l79YmUfKm8SvbWfVrz4LU4tAJYL4U8xc\r\n2Itet6t9G7cQLKDKMZFdd93REcBkVAHyR6RTodZ6PAlG1/pE0FpPG8kJRYwM\r\nxqOMpqfjYKRV2xS7SqoCqczMZXav0T1RkOLe5hqKjnIbyHZUKWybF8sS6/0I\r\nfjAPPNInPPbsnuukrKYVMrEpfJzJxVtgpfNhqwAP1EUIOrYhY6a2CLf0q1iV\r\n/G+hUsvDpAoodMsbWzAqUGgzdc2o3T3ZePM=\r\n=A7cG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID1ffcMeP2fWJ4orM7LzhJ422xGioU+dZx0PUndrur6HAiEA+VqLp5AcTJVqF31wEEfQSQVkN62Cj7ohv+HxbyFTY5Y="}],"size":55884,"noattachment":false,"key":"/estimo/-/estimo-2.3.4.tgz"},"_npmUser":{"name":"mbalabash","email":"maksim.balabash@gmail.com"},"directories":{},"maintainers":[{"name":"mbalabash","email":"maksim.balabash@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/estimo_2.3.4_1645983792855_0.6269850132455941"},"_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":1645983793025,"_cnpm_publish_time":1645983793025,"dist-tags":{"latest":"3.0.3"}}