We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 428b976 commit 68516eeCopy full SHA for 68516ee
example/stress/decorate.ts
@@ -0,0 +1,30 @@
1
+import { Elysia, t } from '../../src'
2
+
3
+const total = 1000
4
+const sub = 50
5
6
+const app = new Elysia()
7
8
+const memory = process.memoryUsage().heapTotal / 1024 / 1024
9
+console.log(`${total} Elysia instances with ${sub} decorations each`)
10
11
+const t1 = performance.now()
12
13
+for (let i = 0; i < total; i++) {
14
+ const plugin = new Elysia()
15
16
+ for (let j = 0; j < sub; j++)
17
+ plugin.decorate('a', {
18
+ [`value-${i * sub + j}`]: 1
19
+ })
20
21
+ app.use(plugin)
22
+}
23
24
+const t2 = performance.now()
25
26
+Bun.gc(true)
27
28
+const memoryAfter = process.memoryUsage().heapTotal / 1024 / 1024
29
+console.log(+(memoryAfter - memory).toFixed(2), 'MB memory used')
30
+console.log(+(t2 - t1).toFixed(2), 'ms')
0 commit comments