bun-http-framework-benchmark
bun-http-framework-benchmark copied to clipboard
feat: add ultimate-express
You should add app.set("etag", false), since a lot of performance will be taken to just hash responses instead of actually routing (a lot of frameworks don't add etag out of box, so it wouldn't be a fair benchmark)
You should also only read body on endpoint that actually needs it. I also made some fixes and performance improvements to library, update it to 1.2.5 please.
Code after changes should be:
const uExpress = require('ultimate-express')
const app = uExpress()
app.set("etag", false)
app.get('/', (req, res) => {
res.setHeader('content-type', 'text/plain').send('Hi')
})
app.post('/json', uExpress.json(), ({ body }, res) => {
res.json(body)
})
app.get('/id/:id', ({ params: { id }, query: { name } }, res) => {
res.setHeader('x-powered-by', 'benchmark')
.setHeader('content-type', 'text/plain')
.send(`${id} ${name}`)
})
app.listen(3000, () => {})