Skip to content

Commit

Permalink
change path for short static route bench
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-tymoshenko committed Dec 27, 2021
1 parent 9207236 commit 2160f2a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const FindMyWay = require('./')

const findMyWay = new FindMyWay()
findMyWay.on('GET', '/', () => true)
findMyWay.on('GET', '/a', () => true)
findMyWay.on('GET', '/user/:id', () => true)
findMyWay.on('GET', '/user/:id/static', () => true)
findMyWay.on('POST', '/user/:id', () => true)
Expand Down Expand Up @@ -46,9 +47,12 @@ constrained.on('GET', '/versioned', { constraints: { version: '2.0.0', host: 'ex
constrained.on('GET', '/versioned', { constraints: { version: '2.0.0', host: 'fastify.io' } }, () => true)

suite
.add('lookup static route', function () {
.add('lookup root "/" route', function () {
findMyWay.lookup({ method: 'GET', url: '/', headers: { host: 'fastify.io' } }, null)
})
.add('lookup static route', function () {
findMyWay.lookup({ method: 'GET', url: '/a', headers: { host: 'fastify.io' } }, null)
})
.add('lookup dynamic route', function () {
findMyWay.lookup({ method: 'GET', url: '/user/tomas', headers: { host: 'fastify.io' } }, null)
})
Expand All @@ -73,9 +77,12 @@ suite
.add('lookup static constrained (version & host) route', function () {
constrained.lookup({ method: 'GET', url: '/versioned', headers: { 'accept-version': '2.x', host: 'fastify.io' } }, null)
})
.add('find static route', function () {
.add('find root "/" route', function () {
findMyWay.find('GET', '/', undefined)
})
.add('find static route', function () {
findMyWay.find('GET', '/a', undefined)
})
.add('find dynamic route', function () {
findMyWay.find('GET', '/user/tomas', undefined)
})
Expand Down

0 comments on commit 2160f2a

Please sign in to comment.