{"id":13734628,"url":"https://github.com/EverlastingBugstopper/cf-workers-benchmark","last_synced_at":"2025-05-08T10:32:45.508Z","repository":{"id":40754276,"uuid":"144176111","full_name":"EverlastingBugstopper/cf-workers-benchmark","owner":"EverlastingBugstopper","description":"Example development environment with three patterns for benchmarking Cloudflare edge workers.","archived":true,"fork":false,"pushed_at":"2022-11-09T00:01:14.000Z","size":392,"stargazers_count":2,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-15T03:33:26.364Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EverlastingBugstopper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-09T16:10:18.000Z","updated_at":"2023-01-27T19:03:39.000Z","dependencies_parsed_at":"2023-01-21T06:19:43.401Z","dependency_job_id":null,"html_url":"https://github.com/EverlastingBugstopper/cf-workers-benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EverlastingBugstopper%2Fcf-workers-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EverlastingBugstopper%2Fcf-workers-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EverlastingBugstopper%2Fcf-workers-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EverlastingBugstopper%2Fcf-workers-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EverlastingBugstopper","download_url":"https://codeload.github.com/EverlastingBugstopper/cf-workers-benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253046003,"owners_count":21845824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T03:00:58.240Z","updated_at":"2025-05-08T10:32:45.206Z","avatar_url":"https://github.com/EverlastingBugstopper.png","language":"JavaScript","funding_links":[],"categories":["Tool"],"sub_categories":[],"readme":"# Cloudflare Workers Time Tests\n\n## Usage\n\n```bash\nnpm run install\nnpm run build\n```\n\n### Identifying Bottleneck Functions\n\n#### If you want to get into the weeds\n\nThis setup is most useful when you are trying to trace down where the most CPU time is going. It runs in the node environment, so don't expect its output to be realistic in production. You can change what function to time in `time.js`. `njstrace` runs by hijacking the compile method and tracks the time of nested functions as well. \n\n```bash\n$ npm run transpile\n$ npm run time:bottleneck\n                     _getHello @ response.js            0ms\n                     _getWorld @ response.js            0ms\n                   getResponse @ response.js            2ms\n```\n\n#### If you don't want to use Babel\n\nUse this if you want a quick and dirty way to start timing things.\n\nNote that this runs in the preview environment, which is ~5x faster than production. This can be used for smaller measurements without Babel. \n\n```js\nconsole.time('func');\nawait func();\nconsole.timeEnd('func');\n```\n\n```bash\nnpm run build\nnpm run time:preview\n```\n\n### Testing production requests\n\nUse this if want to see how long your requests take. The number of milliseconds is simply the time spent waiting for the entire request to complete. This uses `Date.now()` and is tied to the fetch event request, so this is about as helpful as just using the network tab for requests.\n\nThis setup assumes you have deployed the worker you want to time to production.\n\n```bash\nnpm run build\nnpm run time:request\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEverlastingBugstopper%2Fcf-workers-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEverlastingBugstopper%2Fcf-workers-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEverlastingBugstopper%2Fcf-workers-benchmark/lists"}