{"id":16370320,"url":"https://github.com/delvedor/router-benchmark","last_synced_at":"2025-09-13T00:31:51.664Z","repository":{"id":54270050,"uuid":"96563492","full_name":"delvedor/router-benchmark","owner":"delvedor","description":"Benchmark of the most commonly used http routers","archived":false,"fork":false,"pushed_at":"2024-01-05T13:38:14.000Z","size":43,"stargazers_count":78,"open_issues_count":5,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-12-29T20:12:17.503Z","etag":null,"topics":["benchmark","http","router"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/delvedor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-07T18:02:31.000Z","updated_at":"2024-11-29T21:02:04.000Z","dependencies_parsed_at":"2024-10-28T09:12:53.388Z","dependency_job_id":"da478f11-75d0-45dd-b894-638b626fea1d","html_url":"https://github.com/delvedor/router-benchmark","commit_stats":{"total_commits":31,"total_committers":6,"mean_commits":5.166666666666667,"dds":"0.19354838709677424","last_synced_commit":"188cd78c35c553d09df62e5a8763b65d1ef74876"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delvedor%2Frouter-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delvedor%2Frouter-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delvedor%2Frouter-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/delvedor%2Frouter-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/delvedor","download_url":"https://codeload.github.com/delvedor/router-benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232802745,"owners_count":18578684,"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":["benchmark","http","router"],"created_at":"2024-10-11T03:04:46.578Z","updated_at":"2025-01-06T23:54:06.303Z","avatar_url":"https://github.com/delvedor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# router-benchmark\n\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) [![Build Status](https://travis-ci.org/delvedor/router-benchmark.svg?branch=master)](https://travis-ci.org/delvedor/router-benchmark)\n\nBenchmark of the most commonly used http routers.\n\nTested routers:\n\n- [find-my-way](https://github.com/delvedor/find-my-way)\n- [call](https://github.com/hapijs/call)\n- [express](https://www.npmjs.com/package/express)\n- [koa-router](https://github.com/alexmingoia/koa-router)\n- [koa-tree-router](https://github.com/steambap/koa-tree-router)\n- [router](https://github.com/pillarjs/router)\n- [routr](https://github.com/yahoo/routr)\n- [server-router](https://github.com/yoshuawuyts/server-router)\n- [trek-router](https://www.npmjs.com/package/trek-router)\n\nThis benchmarks aims to test only http routers, so the method handling should be included.  \nDo you know other routers? [PR](https://github.com/delvedor/router-benchmark/pulls)! :D\n\n\u003ca name=\"results\"\u003e\u003c/a\u003e\n## Results\n*These benchmarks where taken under node v8.9.0, on a MacBook Pro Retina Late 2013 (i7, 16GB of RAM).*\n\n```\n=======================\n find-my-way benchmark\n=======================\nshort static: 10,102,066 ops/sec\nstatic with same radix: 3,887,679 ops/sec\ndynamic route: 1,637,929 ops/sec\nmixed static dynamic: 2,289,554 ops/sec\nlong static: 5,403,719 ops/sec\nwildcard: 3,037,119 ops/sec\nall together: 525,798 ops/sec\n\n================\n call benchmark\n================\nshort static: 3,123,503 ops/sec\nstatic with same radix: 3,094,106 ops/sec\ndynamic route: 578,251 ops/sec\nmixed static dynamic: 632,624 ops/sec\nlong static: 3,491,147 ops/sec\nwildcard: 884,869 ops/sec\nall together: 181,587 ops/sec\n\n================================================\n express benchmark (WARNING: includes handling)\n================================================\nshort static: 1,145,409 ops/sec\nstatic with same radix: 1,102,656 ops/sec\ndynamic route: 595,169 ops/sec\nmixed static dynamic: 513,327 ops/sec\nlong static: 642,545 ops/sec\nwildcard: 407,398 ops/sec\nall together: 100,184 ops/sec\n\n======================\n koa-router benchmark\n======================\nshort static: 1,004,122 ops/sec\nstatic with same radix: 1,029,369 ops/sec\ndynamic route: 1,015,635 ops/sec\nmixed static dynamic: 968,784 ops/sec\nlong static: 1,027,857 ops/sec\nwildcard: 1,033,432 ops/sec\nall together: 161,220 ops/sec\n\n===========================\n koa-tree-router benchmark\n===========================\nshort static: 11,756,182 ops/sec\nstatic with same radix: 6,212,981 ops/sec\ndynamic route: 3,221,744 ops/sec\nmixed static dynamic: 4,160,595 ops/sec\nlong static: 7,723,753 ops/sec\nwildcard: 4,469,051 ops/sec\nall together: 924,587 ops/sec\n\n===============================================\n router benchmark (WARNING: includes handling)\n===============================================\nshort static: 1,176,121 ops/sec\nstatic with same radix: 1,110,484 ops/sec\ndynamic route: 628,130 ops/sec\nmixed static dynamic: 536,107 ops/sec\nlong static: 678,598 ops/sec\nwildcard: 356,475 ops/sec\nall together: 99,443 ops/sec\n\n=================\n routr benchmark\n=================\nshort static: 4,562,784 ops/sec\nstatic with same radix: 2,530,725 ops/sec\ndynamic route: 850,739 ops/sec\nmixed static dynamic: 553,497 ops/sec\nlong static: 520,461 ops/sec\nwildcard: 348,495 ops/sec\nall together: 108,098 ops/sec\n\n=========================\n server-router benchmark\n=========================\nshort static: 2,500,623 ops/sec\nstatic with same radix: 2,404,634 ops/sec\ndynamic route: 1,102,154 ops/sec\nmixed static dynamic: 1,094,229 ops/sec\nlong static: 1,555,080 ops/sec\nwildcard: 924,381 ops/sec\nall together: 215,779 ops/sec\n\n=======================\n trek-router benchmark\n=======================\nshort static: 8,530,466 ops/sec\nstatic with same radix: 4,861,846 ops/sec\ndynamic route: 2,240,906 ops/sec\nmixed static dynamic: 2,539,650 ops/sec\nlong static: 5,525,210 ops/sec\nwildcard: 3,533,566 ops/sec\nall together: 612,419 ops/sec\n```\n\n### Run the benchmarks\nDo you wan to run the benchmarks by yourself?  \nRun the following:\n```bash\ngit clone https://github.com/delvedor/router-benchmark\ncd router-benchmark\nnpm i\nnpm start\n```\n\n\u003ca name=\"features\"\u003e\u003c/a\u003e\n## Router features\n| Router | Framework independent    | Decode URI    | Querystring handling   |  Regex route support | Multi-parametric route support |  Max parameter length |\n| :------------ | :------------ | :------------ | :--------------------- | :------------------- |:------------------------------ |:--------------------- |\n| `find-my-way` | \u0026#10003; | \u0026#10003; | \u0026#10003; | \u0026#10003; | \u0026#10003; | \u0026#10003; |\n| `call` | \u0026#10003;  | \u0026#10003; | \u0026#10007; | ? | ? | ? |\n| `express` | \u0026#10007;  | \u0026#10003; | \u0026#10003; | \u0026#10003; | \u0026#10003; | \u0026#10007; |\n| `koa-router` | \u0026#10007;  | \u0026#10007; | \u0026#10007; | \u0026#10003; | \u0026#10003; | \u0026#10007; |\n| `koa-tree-router` | \u0026#10007; | \u0026#10007; | \u0026#10007; | \u0026#10007; | \u0026#10007; | \u0026#10007;  |\n| `router` | \u0026#10003;  | \u0026#10003; | \u0026#10003; | \u0026#10003; | \u0026#10003; | \u0026#10007; |\n| `routr` | \u0026#10003; | \u0026#10003; | \u0026#10003; | \u0026#10007; | \u0026#10007; | \u0026#10007; |\n| `server-router` | \u0026#10003; | \u0026#10003; | \u0026#10007; | \u0026#10007;| \u0026#10007; | \u0026#10007; |\n| `trek-router` | \u0026#10007; | \u0026#10007; | \u0026#10007; | \u0026#10007; | \u0026#10007; | \u0026#10007; |\n\n*Did you find incorrect data in the above table? Please send a pr!*\n\n\u003ca name=\"how\"\u003e\u003c/a\u003e\n## How the benchmark is taken\n\nTo emulate a real world situation every router registers the following routes:\n```\n{ method: 'GET', url: '/user' },\n{ method: 'GET', url: '/user/comments' },\n{ method: 'GET', url: '/user/avatar' },\n{ method: 'GET', url: '/user/lookup/username/:username' },\n{ method: 'GET', url: '/user/lookup/email/:address' },\n{ method: 'GET', url: '/event/:id' },\n{ method: 'GET', url: '/event/:id/comments' },\n{ method: 'POST', url: '/event/:id/comment' },\n{ method: 'GET', url: '/map/:location/events' },\n{ method: 'GET', url: '/status' },\n{ method: 'GET', url: '/very/deeply/nested/route/hello/there' },\n{ method: 'GET', url: '/static/*' }\n```\nThen the following routes are tested:\n```\nshort static: { method: 'GET', url: '/user' }\nstatic with same radix: { method: 'GET', url: '/user/comments' }\ndynamic route: { method: 'GET', url: '/user/lookup/username/john' }\nmixed static dynamic: { method: 'GET', url: '/event/abcd1234/comments' },\nlong static: { method: 'GET', url: '/very/deeply/nested/route/hello/there' },\nwildcard: { method: 'GET', url: '/static/index.html' }\nall together: all the above at the same time\n```\nEvery test is executed 1 million times, the time is taken with `process.hrtime()`, the final result is expressed in operations per second.\n\n\u003ca name=\"todo\"\u003e\u003c/a\u003e\n### TODO:\n- [ ] Add a list of the supported features by every router\n\n\u003ca name=\"license\"\u003e\u003c/a\u003e\n## License\n\n[MIT](https://github.com/delvedor/router-benchmark/blob/master/LICENSE)\n\nCopyright © 2017 Tomas Della Vedova\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelvedor%2Frouter-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdelvedor%2Frouter-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelvedor%2Frouter-benchmark/lists"}