|
1 | 1 | import { bench } from '@ark/attest' |
2 | | -import { RoutePattern, type HrefArgs } from '@remix-run/route-pattern' |
| 2 | +import { RoutePattern } from '@remix-run/route-pattern' |
3 | 3 |
|
4 | | -bench('href', () => { |
| 4 | +bench.baseline(() => { |
| 5 | + let pattern = new RoutePattern('/') |
| 6 | + pattern.href() |
| 7 | +}) |
| 8 | + |
| 9 | +bench('href > simple route', () => { |
5 | 10 | let pattern = new RoutePattern('/posts/:id') |
6 | 11 | pattern.href({ id: '123' }) |
7 | | -}).types([1344, 'instantiations']) |
| 12 | +}).types([1171, 'instantiations']) |
| 13 | + |
| 14 | +bench('href > complex route', () => { |
| 15 | + let pattern = new RoutePattern('/api(/v:major(.:minor))/*path/help') |
| 16 | + pattern.href({ major: '1', minor: '2', path: 'users', help: 'help' }) |
| 17 | +}).types([4575, 'instantiations']) |
| 18 | + |
| 19 | +bench('href > mediarss', () => { |
| 20 | + type Route = keyof typeof import('../routes/mediarss.ts').routes |
| 21 | + let routes: { [route in Route]: RoutePattern<route> } = {} as any |
8 | 22 |
|
9 | | -bench('HrefArgs', () => { |
10 | | - type _ = HrefArgs<'/posts/:id'> |
11 | | -}).types([1059, 'instantiations']) |
| 23 | + routes.feed.href({ token: '123' }) |
| 24 | + routes.media.href({ token: '123', path: 'users' }) |
| 25 | + routes.art.href({ token: '123', path: 'users' }) |
| 26 | + // OAuth routes (public) |
| 27 | + routes.oauthToken.href() |
| 28 | + routes.oauthJwks.href() |
| 29 | + routes.oauthRegister.href() |
| 30 | + routes.oauthServerMetadata.href() |
| 31 | + // MCP routes |
| 32 | + routes.mcp.href() |
| 33 | + routes.mcpProtectedResource.href() |
| 34 | + routes.mcpWidget.href({ token: '123', path: 'users' }) |
| 35 | + // Admin routes |
| 36 | + routes.adminHealth.href() |
| 37 | + routes.adminApiVersion.href() |
| 38 | + routes.adminAuthorize.href() |
| 39 | + routes.admin.href() |
| 40 | + routes.adminCatchAll.href({ path: 'users' }) |
| 41 | + routes.adminApiFeeds.href() |
| 42 | + routes.adminApiDirectories.href() |
| 43 | + routes.adminApiBrowse.href() |
| 44 | + routes.adminApiCreateDirectoryFeed.href() |
| 45 | + routes.adminApiCreateCuratedFeed.href() |
| 46 | + routes.adminApiFeed.href({ id: '123' }) |
| 47 | + routes.adminApiFeedTokens.href({ id: '123' }) |
| 48 | + routes.adminApiFeedItems.href({ id: '123' }) |
| 49 | + routes.adminApiFeedArtwork.href({ id: '123' }) |
| 50 | + routes.adminApiToken.href({ token: '123' }) |
| 51 | + routes.adminApiMedia.href() |
| 52 | + routes.adminApiMediaAssignments.href() |
| 53 | + routes.adminApiMediaDetail.href({ path: 'users' }) |
| 54 | + routes.adminApiMediaMetadata.href({ path: 'users' }) |
| 55 | + routes.adminApiMediaStream.href({ path: 'users' }) |
| 56 | + routes.adminApiMediaUpload.href() |
| 57 | + routes.adminApiArtwork.href({ path: 'users' }) |
| 58 | +}).types([39583, 'instantiations']) |
0 commit comments