-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
81 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# 0.1.4 - 15 May 2023 | ||
fix: | ||
- add commonjs support | ||
|
||
# 0.1.3 - 6 May 2023 | ||
feat: | ||
- using charCodeAt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// import { Router } from 'itty-router' | ||
// import { title, now, print, operations } from '../utils' | ||
|
||
// const router = Router() | ||
|
||
// title('itty-router') | ||
|
||
// const routes = [ | ||
// { method: 'GET', url: '/user' }, | ||
// { method: 'GET', url: '/user/comments' }, | ||
// { method: 'GET', url: '/user/avatar' }, | ||
// { method: 'GET', url: '/user/lookup/username/:username' }, | ||
// { method: 'GET', url: '/user/lookup/email/:address' }, | ||
// { method: 'GET', url: '/event/:id' }, | ||
// { method: 'GET', url: '/event/:id/comments' }, | ||
// { method: 'POST', url: '/event/:id/comment' }, | ||
// { method: 'GET', url: '/map/:location/events' }, | ||
// { method: 'GET', url: '/status' }, | ||
// { method: 'GET', url: '/very/deeply/nested/route/hello/there' }, | ||
// { method: 'GET', url: '/static/*a' } | ||
// ] | ||
|
||
// function noop() {} | ||
// var i = 0 | ||
// var time = 0 | ||
|
||
// routes.forEach((route) => { | ||
// // @ts-ignore | ||
// router[route.method](route.url, noop) | ||
// }) | ||
|
||
// time = now() | ||
// let route = { method: 'GET', url: '/user' } | ||
// for (i = 0; i < operations; i++) { | ||
// router.handle(route) | ||
// } | ||
// print('short static:', time) | ||
|
||
// time = now() | ||
// route = { method: 'GET', url: '/user/comments' } | ||
// for (i = 0; i < operations; i++) { | ||
// router.handle(route) | ||
// } | ||
// print('static with same radix:', time) | ||
|
||
// time = now() | ||
// route = { method: 'GET', url: '/user/lookup/username/john' } | ||
// for (i = 0; i < operations; i++) { | ||
// router.handle(route) | ||
// } | ||
// print('dynamic route:', time) | ||
|
||
// time = now() | ||
// route = { method: 'GET', url: '/event/abcd1234/comments' } | ||
// for (i = 0; i < operations; i++) { | ||
// router.handle(route) | ||
// } | ||
// print('mixed static dynamic:', time) | ||
|
||
// time = now() | ||
// route = { | ||
// method: 'GET', | ||
// url: '/very/deeply/nested/route/hello/there' | ||
// } | ||
// for (i = 0; i < operations; i++) { | ||
// router.handle(route) | ||
// } | ||
// print('long static:', time) | ||
|
||
// time = now() | ||
// route = { method: 'GET', url: '/static/index.html' } | ||
// for (i = 0; i < operations; i++) { | ||
// router.handle(route) | ||
// } | ||
// print('wildcard:', time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters