Skip to content

Commit 8611f50

Browse files
committed
chore: update benchmarks
1 parent d3e3f26 commit 8611f50

File tree

4 files changed

+565
-667
lines changed

4 files changed

+565
-667
lines changed

benchmarks/express-hello-world/reflet/app.controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Get, Send } from '@reflet/express'
1+
import { Get, Router, Send } from '@reflet/express'
22
import { Request, Response } from 'express'
33

44
@Send()
5+
@Router('')
56
export class AppController {
67
@Get('/')
78
get(req: Request, res: Response) {

benchmarks/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
"start": "ts-node -T run.ts"
1010
},
1111
"devDependencies": {
12-
"@nestjs/common": "^7.0.13",
13-
"@nestjs/core": "^7.0.13",
14-
"@nestjs/platform-express": "^7.0.13",
15-
"@reflet/express": "^2.0.0-next.0",
16-
"@types/autocannon": "^4.1.0",
17-
"autocannon": "^4.6.0",
18-
"class-transformer": "^0.2.3",
19-
"class-validator": "^0.12.2",
12+
"@nestjs/common": "^10.1.3",
13+
"@nestjs/core": "^10.1.3",
14+
"@nestjs/platform-express": "^10.1.3",
15+
"@reflet/express": "^2.0.0",
16+
"@types/autocannon": "^7.9.1",
17+
"autocannon": "^7.11.0",
18+
"class-transformer": "^0.5.1",
19+
"class-validator": "^0.14.0",
2020
"reflect-metadata": "^0.1.13",
21-
"routing-controllers": "^0.8.1",
22-
"rxjs": "^6.5.5"
21+
"routing-controllers": "^0.10.4",
22+
"rxjs": "^7.8.1"
2323
}
2424
}

benchmarks/run.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import { join } from 'path'
22
import { spawn } from 'child_process'
33
import { build } from 'tsc-prog'
4-
import autocannon from 'autocannon'
4+
import * as autocannon from 'autocannon'
5+
import { inspect } from 'util'
56

67
const rootDir = 'express-hello-world'
78
const outDir = `${rootDir}-dist`
89
const libs = ['plain', 'reflet', 'nest', 'routing-controllers'] as const
9-
type Result = autocannon.Result & { title: typeof libs[number] }
10+
11+
type Lib = (typeof libs)[number]
12+
type Result = autocannon.Result & { title: Lib }
1013

1114
build({
1215
basePath: __dirname,
@@ -22,14 +25,14 @@ build({
2225
results.push(result)
2326
}
2427

25-
console.log(results)
28+
console.log('\nFull Results:\n', inspect(results, { compact: true, breakLength: 2000, colors: true }))
2629
})()
2730

28-
async function runExpressWith(lib: typeof libs[number]) {
31+
async function runExpressWith(lib: Lib) {
2932
const libPath = join(__dirname, outDir, lib, 'index.js')
3033
const process = spawn('node', [libPath])
3134

32-
console.log(`\n===============\n${lib.toUpperCase()}\n===============\n`)
35+
console.log(`\n===============\n${lib.toUpperCase()}\n===============`)
3336

3437
await new Promise((resolve) => setTimeout(resolve, 1000))
3538

@@ -39,7 +42,7 @@ async function runExpressWith(lib: typeof libs[number]) {
3942
url: 'http://localhost:3001',
4043
title: lib,
4144
connections: 100,
42-
duration: '10s',
45+
duration: '2s',
4346
},
4447
(err, result) => {
4548
process.kill()

0 commit comments

Comments
 (0)