{"name":"estimo","version":"2.2.2","description":"Evaluates how long the browser will execute your javascript code.","main":"index.js","scripts":{"install":"node ./scripts/findChrome.js","prettier":"prettier --write -l '(src|tests)/**/*.js'","eslint":"eslint --cache src","test":"ava --timeout=4m --exit","clean:temp":"rimraf ./temp/*.{html,json}","clean:chrome-config":"node ./scripts/cleanChromeConfig.js","docker:build":"docker build -t estimo .","test:docker":"docker run --rm --init -v $(pwd)/temp:/app/temp estimo","test:launch":"ESTIMO_DEBUG=true node ./tests/__mock__/test-launch.js"},"engines":{"node":">=10"},"dependencies":{"nanoid":"^3.1.11","puppeteer-core":"^5.2.1","tracium":"^0.2.1","yargs":"^15.4.1"},"devDependencies":{"@commitlint/cli":"^9.1.1","@commitlint/config-conventional":"^9.1.1","ava":"^3.11.0","eslint":"^7.5.0","eslint-config-airbnb":"^18.2.0","eslint-config-prettier":"^6.11.0","eslint-plugin-import":"^2.22.0","husky":"^4.2.5","lint-staged":"^10.2.11","prettier":"^2.0.5","rimraf":"^3.0.2"},"bin":{"estimo":"scripts/cli.js"},"preferGlobal":true,"husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS","pre-commit":"lint-staged"}},"lint-staged":{"*.(json)":["yarn clean:chrome-config","git add"],"*.(js)":["yarn prettier","yarn eslint","git add"]},"ava":{"concurrency":1,"files":["tests/**/*.js","!tests/__mock__/**"]},"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":["chrome","tracium","puppeteer","devtools","size-limit","performance","js"],"author":{"name":"mbalabash","email":"maksim.balabash@gmail.com"},"license":"MIT","gitHead":"670ac40d50ddaaceab6ae40335bf26c0682aef57","_id":"estimo@2.2.2","_nodeVersion":"15.4.0","_npmVersion":"7.0.15","dist":{"integrity":"sha512-08KMAaY8mOld50/qqAP4+Zpd8GuPgBxxaEHLF9JWHjiGzSEVWnO8/t5e6lhfYodii8DPvSxRnOZcOYk/kxXrEA==","shasum":"cb135b742bdf1958c8d38b137f4411866d0bbbb0","tarball":"http://registry-npm.ywwl.com/estimo/download/estimo-2.2.2.tgz","fileCount":43,"unpackedSize":449860,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf2QbwCRA9TVsSAnZWagAAKowP/3bepNMo+NngdAEnM6Ox\nZ5mm6Ycc8b2cg/OYGGgKd8N214tUAuE+c9QtXEe4RzS3lpLEu/Aes0dVHkeN\nE2qcQ4gezph5kSaV1xdZuhDXq7zQSEcv62SVrcz2GDALoVkVVWFZpiR3jkVQ\nMzkNRWpF/cuJDBrvJDwKPueinOZRw/uw7AuCzrHIuVXZ5aHq7RaWUobJYL3G\nkjeOs5Bv4c2ibg9JZlht22JV2tpDsnOlIShLnf6ITuErqjh0MybckHpPiR3X\nr7LYsnkrs7zKDm2q++A7TVpQA9Fd1N/e2tQqc1wlqSuqiulDlurg0cvdQJhM\n5V6TxXTILVgdUuZeBsXIteOHQJIaVwXiwJpIAp00e2YgRh6BaJU++ZVcb8OB\nx7qpidIFcpb7cjysyTQ0bLKo9yQjqRIKAjhXf4E8QlTQ1IO0Dca1mswFFSlp\nfRqFK6Hez9gSsbs+VaX1CwyuXQ9t7xRnR94gPfkASPyvCh4YgOWZ/mhUL1rc\nprvgq8GEnET5HmoB+8OXzUXXDnjuGE5aA9G1/srOD3FLu9/zNXMuN4LxmBEz\np9IGX66VQ4qEP+R8Dn2Mo8dsuOLkESclISDQmJXKF7ejX1fUfgC7q0ZhsQBt\nV5+UtFHbA5SWvuep+AHfehtfeRjH3VwKyDpMXq+BEJGsaaJIs8I3rRuQ0UOG\nn2Qf\r\n=ziHT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGEaZ7TcYuBNKuYeW+XrkIFOZgjE/fKienqgUXNTv47EAiBhnVs1vyqlm7XtPZDM0Ufv19JE+ZbQAdnG+LZKn3J7iw=="}],"size":61599,"noattachment":false,"key":"/estimo/-/estimo-2.2.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.2.2_1608058607842_0.6624312341404108"},"_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":1608058608028,"_cnpm_publish_time":1608058608028,"dist-tags":{"latest":"3.0.3"}}