{"name":"estimo","version":"2.3.2","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":{"install":"node ./scripts/find-chrome-binary.js","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":"^8.3.0","find-chrome-bin":"^0.1.0","nanoid":"^3.2.0","puppeteer-core":"^13.1.1"},"devDependencies":{"@logux/eslint-config":"^46.1.1","ava":"^3.15.0","check-dts":"^0.6.6","eslint":"^8.7.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":"1a5e2c64ccb0fcb2c4ef940e0ee9a77fafab97ab","_id":"estimo@2.3.2","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-k3EN4z4ZnSUaz6eZAFIHl8pcdc2S0lK3+C0WNINg/e2nkgKAykOOGpa2TXRz/g8bWo6E1XuF12TuhnN9/lfbFQ==","shasum":"abb207dedac8b4ee4f857029807b79272e432282","tarball":"http://registry-npm.ywwl.com/estimo/download/estimo-2.3.2.tgz","fileCount":35,"unpackedSize":438821,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh7IGXCRA9TVsSAnZWagAAvGoQAKQybz+gTjOjdmFUQwK3\n0oKEozRFCto2rHp7oj0UO3a4rHlfX49yX3mdDHfgYzRzjfKIxb+LIqNjXsXX\na5KLM25a4x5vQScyPvKYwWcpVWgOnoSxGStSfs9I6SxdFxdJkgEicSMue/IS\ng1KUFAerkmkkpWANsD3eWMwGYhCkZfDHQGWMo17myaz9reAD3PhMT6TLC18n\nhicpWP8h+KfbCsBDqJ4zEPUo3TiCUtX6z3GH0kJ7kqI3MYpmB+t/TklsPnvq\nNT4RE4E2/8UWJXUvQgkZTo3D1M9NzuU9dpICX31EhRfm5N6o4hwmf6Cw1lzh\n99BLLOb5j1PvnzOMy6ekr7jMqh41R2caSRoKZOLNpuk5aWDOiGJtJSpzYCro\nGXYYsJCLD1rOH6Ww5Br+lK3uQ1zkQXDDQlVTQ6E2cdl3w8gcmzVS/tOtfa2B\neAQLiUaj7xcQOvRzbnBnAlZtrvlfJ8oOt9kLRCkf74Se2UN1VERcPrKsjeOa\nx3neR77lLe9wWsYwokU84+5fGVKrLu7xurHuHwyCA9Pi/4AvoOdVXqv1tgSq\nOCRdmIR5zzxKhw0DbqqlVMIkWUVzMhf6GlDjMYDs/enEmegTA/WybSPbMhr5\nJhJZPemL0G9k/UExeaEClEJ3+xT0ElQKmC+FNuC5X8Hj9WAO0wmIVBOe/CmZ\nLzOX\r\n=yw7Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICOCueQa72sAUqGO1vHMcMlrqWygiVhi6suA2+HBWGMxAiEA6c26o7bhp0b/UrP3m56zWIx0X5C9I81yCBgl8k8Eoy8="}],"size":58621,"noattachment":false,"key":"/estimo/-/estimo-2.3.2.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.2_1642889623158_0.285541622797725"},"_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":1642889623307,"_cnpm_publish_time":1642889623307,"dist-tags":{"latest":"3.0.3"}}