@nestia/benchmark 12.0.0-rc.2 → 12.0.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/package.json +2 -2
- package/src/DynamicBenchmarker.ts +465 -465
- package/src/IBenchmarkEvent.ts +10 -10
- package/src/index.ts +2 -2
- package/src/internal/DynamicBenchmarkReporter.ts +104 -104
- package/src/internal/IBenchmarkMaster.ts +4 -4
- package/src/internal/IBenchmarkServant.ts +8 -8
- package/README.md +0 -93
package/src/IBenchmarkEvent.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IFetchRoute } from "@nestia/fetcher";
|
|
2
|
-
|
|
3
|
-
export interface IBenchmarkEvent {
|
|
4
|
-
metadata: IFetchRoute<any>;
|
|
5
|
-
status: number | null;
|
|
6
|
-
started_at: string;
|
|
7
|
-
respond_at: string | null;
|
|
8
|
-
completed_at: string;
|
|
9
|
-
success: boolean;
|
|
10
|
-
}
|
|
1
|
+
import { IFetchRoute } from "@nestia/fetcher";
|
|
2
|
+
|
|
3
|
+
export interface IBenchmarkEvent {
|
|
4
|
+
metadata: IFetchRoute<any>;
|
|
5
|
+
status: number | null;
|
|
6
|
+
started_at: string;
|
|
7
|
+
respond_at: string | null;
|
|
8
|
+
completed_at: string;
|
|
9
|
+
success: boolean;
|
|
10
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./DynamicBenchmarker";
|
|
2
|
-
export * from "./IBenchmarkEvent";
|
|
1
|
+
export * from "./DynamicBenchmarker";
|
|
2
|
+
export * from "./IBenchmarkEvent";
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import os from "os";
|
|
2
|
-
|
|
3
|
-
import { DynamicBenchmarker } from "../DynamicBenchmarker";
|
|
4
|
-
|
|
5
|
-
export namespace DynamicBenchmarkReporter {
|
|
6
|
-
export const markdown = (report: DynamicBenchmarker.IReport): string => {
|
|
7
|
-
const format = (value: number | null) =>
|
|
8
|
-
value === null ? "N/A" : (Math.floor(value * 100) / 100).toLocaleString();
|
|
9
|
-
const head = () =>
|
|
10
|
-
[
|
|
11
|
-
"Type",
|
|
12
|
-
"Count",
|
|
13
|
-
"Success",
|
|
14
|
-
"Mean.",
|
|
15
|
-
"Stdev.",
|
|
16
|
-
"Minimum",
|
|
17
|
-
"Maximum",
|
|
18
|
-
].join(" | ") +
|
|
19
|
-
"\n" +
|
|
20
|
-
new Array(7).fill("----").join("|");
|
|
21
|
-
const row = (title: string, s: DynamicBenchmarker.IReport.IStatistics) =>
|
|
22
|
-
[
|
|
23
|
-
title,
|
|
24
|
-
s.count.toLocaleString(),
|
|
25
|
-
s.success.toLocaleString(),
|
|
26
|
-
format(s.mean),
|
|
27
|
-
format(s.stdev),
|
|
28
|
-
format(s.minimum),
|
|
29
|
-
format(s.maximum),
|
|
30
|
-
].join(" | ");
|
|
31
|
-
const line = (
|
|
32
|
-
title: string,
|
|
33
|
-
getter: (m: NodeJS.MemoryUsage) => number,
|
|
34
|
-
): string =>
|
|
35
|
-
`line "${title}" [${report.memories.map((m) => Math.floor(getter(m.usage) / 1024 ** 2)).join(", ")}]`;
|
|
36
|
-
|
|
37
|
-
return [
|
|
38
|
-
`# Benchmark Report`,
|
|
39
|
-
"> Generated by [`@nestia/benchmark`](https://github.com/samchon/nestia)",
|
|
40
|
-
``,
|
|
41
|
-
` - Specifications`,
|
|
42
|
-
` - CPU: ${os.cpus()[0]!.model}`,
|
|
43
|
-
` - RAM: ${Math.floor(os.totalmem() / 1024 / 1024 / 1024).toLocaleString()} GB`,
|
|
44
|
-
` - NodeJS Version: ${process.version}`,
|
|
45
|
-
` - Backend Server: 1 core / 1 thread`,
|
|
46
|
-
` - Arguments`,
|
|
47
|
-
` - Count: ${report.count.toLocaleString()}`,
|
|
48
|
-
` - Threads: ${report.threads.toLocaleString()}`,
|
|
49
|
-
` - Simultaneous: ${report.simultaneous.toLocaleString()}`,
|
|
50
|
-
` - Time`,
|
|
51
|
-
` - Start: ${report.started_at}`,
|
|
52
|
-
` - Complete: ${report.completed_at}`,
|
|
53
|
-
` - Elapsed: ${(new Date(report.completed_at).getTime() - new Date(report.started_at).getTime()).toLocaleString()} ms`,
|
|
54
|
-
``,
|
|
55
|
-
head(),
|
|
56
|
-
row("Total", report.statistics),
|
|
57
|
-
"",
|
|
58
|
-
"> Unit: milliseconds",
|
|
59
|
-
"",
|
|
60
|
-
"## Memory Consumptions",
|
|
61
|
-
"```mermaid",
|
|
62
|
-
"xychart-beta",
|
|
63
|
-
` x-axis "Time (second)"`,
|
|
64
|
-
` y-axis "Memory (MB)"`,
|
|
65
|
-
` ${line("Resident Set Size", (m) => m.rss)}`,
|
|
66
|
-
` ${line("Heap Total", (m) => m.heapTotal)}`,
|
|
67
|
-
` ${line("Heap Used + External", (m) => m.heapUsed + m.external)}`,
|
|
68
|
-
` ${line("Heap Used Only", (m) => m.heapUsed)}`,
|
|
69
|
-
"```",
|
|
70
|
-
"",
|
|
71
|
-
`> - 🟦 Resident Set Size`,
|
|
72
|
-
`> - 🟢 Heap Total`,
|
|
73
|
-
`> - 🔴 Heap Used + External`,
|
|
74
|
-
`> - 🟡 Heap Used Only`,
|
|
75
|
-
"",
|
|
76
|
-
"## Endpoints",
|
|
77
|
-
head(),
|
|
78
|
-
...report.endpoints
|
|
79
|
-
.slice()
|
|
80
|
-
.sort((a, b) => (b.mean ?? 0) - (a.mean ?? 0))
|
|
81
|
-
.map((endpoint) =>
|
|
82
|
-
row(`${endpoint.method} ${endpoint.path}`, endpoint),
|
|
83
|
-
),
|
|
84
|
-
"",
|
|
85
|
-
"> Unit: milliseconds",
|
|
86
|
-
"",
|
|
87
|
-
"## Failures",
|
|
88
|
-
"Method | Path | Count | Failures",
|
|
89
|
-
"-------|------|-------|----------",
|
|
90
|
-
...report.endpoints
|
|
91
|
-
.filter((e) => e.success !== e.count)
|
|
92
|
-
.slice()
|
|
93
|
-
.sort((a, b) => b.count - a.count)
|
|
94
|
-
.map((e) =>
|
|
95
|
-
[
|
|
96
|
-
e.method,
|
|
97
|
-
e.path,
|
|
98
|
-
e.count.toLocaleString(),
|
|
99
|
-
(e.count - e.success).toLocaleString(),
|
|
100
|
-
].join(" | "),
|
|
101
|
-
),
|
|
102
|
-
].join("\n");
|
|
103
|
-
};
|
|
104
|
-
}
|
|
1
|
+
import os from "os";
|
|
2
|
+
|
|
3
|
+
import { DynamicBenchmarker } from "../DynamicBenchmarker";
|
|
4
|
+
|
|
5
|
+
export namespace DynamicBenchmarkReporter {
|
|
6
|
+
export const markdown = (report: DynamicBenchmarker.IReport): string => {
|
|
7
|
+
const format = (value: number | null) =>
|
|
8
|
+
value === null ? "N/A" : (Math.floor(value * 100) / 100).toLocaleString();
|
|
9
|
+
const head = () =>
|
|
10
|
+
[
|
|
11
|
+
"Type",
|
|
12
|
+
"Count",
|
|
13
|
+
"Success",
|
|
14
|
+
"Mean.",
|
|
15
|
+
"Stdev.",
|
|
16
|
+
"Minimum",
|
|
17
|
+
"Maximum",
|
|
18
|
+
].join(" | ") +
|
|
19
|
+
"\n" +
|
|
20
|
+
new Array(7).fill("----").join("|");
|
|
21
|
+
const row = (title: string, s: DynamicBenchmarker.IReport.IStatistics) =>
|
|
22
|
+
[
|
|
23
|
+
title,
|
|
24
|
+
s.count.toLocaleString(),
|
|
25
|
+
s.success.toLocaleString(),
|
|
26
|
+
format(s.mean),
|
|
27
|
+
format(s.stdev),
|
|
28
|
+
format(s.minimum),
|
|
29
|
+
format(s.maximum),
|
|
30
|
+
].join(" | ");
|
|
31
|
+
const line = (
|
|
32
|
+
title: string,
|
|
33
|
+
getter: (m: NodeJS.MemoryUsage) => number,
|
|
34
|
+
): string =>
|
|
35
|
+
`line "${title}" [${report.memories.map((m) => Math.floor(getter(m.usage) / 1024 ** 2)).join(", ")}]`;
|
|
36
|
+
|
|
37
|
+
return [
|
|
38
|
+
`# Benchmark Report`,
|
|
39
|
+
"> Generated by [`@nestia/benchmark`](https://github.com/samchon/nestia)",
|
|
40
|
+
``,
|
|
41
|
+
` - Specifications`,
|
|
42
|
+
` - CPU: ${os.cpus()[0]!.model}`,
|
|
43
|
+
` - RAM: ${Math.floor(os.totalmem() / 1024 / 1024 / 1024).toLocaleString()} GB`,
|
|
44
|
+
` - NodeJS Version: ${process.version}`,
|
|
45
|
+
` - Backend Server: 1 core / 1 thread`,
|
|
46
|
+
` - Arguments`,
|
|
47
|
+
` - Count: ${report.count.toLocaleString()}`,
|
|
48
|
+
` - Threads: ${report.threads.toLocaleString()}`,
|
|
49
|
+
` - Simultaneous: ${report.simultaneous.toLocaleString()}`,
|
|
50
|
+
` - Time`,
|
|
51
|
+
` - Start: ${report.started_at}`,
|
|
52
|
+
` - Complete: ${report.completed_at}`,
|
|
53
|
+
` - Elapsed: ${(new Date(report.completed_at).getTime() - new Date(report.started_at).getTime()).toLocaleString()} ms`,
|
|
54
|
+
``,
|
|
55
|
+
head(),
|
|
56
|
+
row("Total", report.statistics),
|
|
57
|
+
"",
|
|
58
|
+
"> Unit: milliseconds",
|
|
59
|
+
"",
|
|
60
|
+
"## Memory Consumptions",
|
|
61
|
+
"```mermaid",
|
|
62
|
+
"xychart-beta",
|
|
63
|
+
` x-axis "Time (second)"`,
|
|
64
|
+
` y-axis "Memory (MB)"`,
|
|
65
|
+
` ${line("Resident Set Size", (m) => m.rss)}`,
|
|
66
|
+
` ${line("Heap Total", (m) => m.heapTotal)}`,
|
|
67
|
+
` ${line("Heap Used + External", (m) => m.heapUsed + m.external)}`,
|
|
68
|
+
` ${line("Heap Used Only", (m) => m.heapUsed)}`,
|
|
69
|
+
"```",
|
|
70
|
+
"",
|
|
71
|
+
`> - 🟦 Resident Set Size`,
|
|
72
|
+
`> - 🟢 Heap Total`,
|
|
73
|
+
`> - 🔴 Heap Used + External`,
|
|
74
|
+
`> - 🟡 Heap Used Only`,
|
|
75
|
+
"",
|
|
76
|
+
"## Endpoints",
|
|
77
|
+
head(),
|
|
78
|
+
...report.endpoints
|
|
79
|
+
.slice()
|
|
80
|
+
.sort((a, b) => (b.mean ?? 0) - (a.mean ?? 0))
|
|
81
|
+
.map((endpoint) =>
|
|
82
|
+
row(`${endpoint.method} ${endpoint.path}`, endpoint),
|
|
83
|
+
),
|
|
84
|
+
"",
|
|
85
|
+
"> Unit: milliseconds",
|
|
86
|
+
"",
|
|
87
|
+
"## Failures",
|
|
88
|
+
"Method | Path | Count | Failures",
|
|
89
|
+
"-------|------|-------|----------",
|
|
90
|
+
...report.endpoints
|
|
91
|
+
.filter((e) => e.success !== e.count)
|
|
92
|
+
.slice()
|
|
93
|
+
.sort((a, b) => b.count - a.count)
|
|
94
|
+
.map((e) =>
|
|
95
|
+
[
|
|
96
|
+
e.method,
|
|
97
|
+
e.path,
|
|
98
|
+
e.count.toLocaleString(),
|
|
99
|
+
(e.count - e.success).toLocaleString(),
|
|
100
|
+
].join(" | "),
|
|
101
|
+
),
|
|
102
|
+
].join("\n");
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface IBenchmarkMaster {
|
|
2
|
-
filter: (file: string) => boolean;
|
|
3
|
-
progress: (current: number) => void;
|
|
4
|
-
}
|
|
1
|
+
export interface IBenchmarkMaster {
|
|
2
|
+
filter: (file: string) => boolean;
|
|
3
|
+
progress: (current: number) => void;
|
|
4
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IBenchmarkEvent } from "../IBenchmarkEvent";
|
|
2
|
-
|
|
3
|
-
export interface IBenchmarkServant {
|
|
4
|
-
execute(props: {
|
|
5
|
-
count: number;
|
|
6
|
-
simultaneous: number;
|
|
7
|
-
}): Promise<IBenchmarkEvent[]>;
|
|
8
|
-
}
|
|
1
|
+
import { IBenchmarkEvent } from "../IBenchmarkEvent";
|
|
2
|
+
|
|
3
|
+
export interface IBenchmarkServant {
|
|
4
|
+
execute(props: {
|
|
5
|
+
count: number;
|
|
6
|
+
simultaneous: number;
|
|
7
|
+
}): Promise<IBenchmarkEvent[]>;
|
|
8
|
+
}
|
package/README.md
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
# Nestia
|
|
2
|
-

|
|
3
|
-
|
|
4
|
-
[](https://github.com/samchon/nestia/blob/master/LICENSE)
|
|
5
|
-
[](https://www.npmjs.com/package/@nestia/fetcher)
|
|
6
|
-
[](https://www.npmjs.com/package/@nestia/fetcher)
|
|
7
|
-
[](https://github.com/samchon/nestia/actions?query=workflow%3Atest)
|
|
8
|
-
[](https://nestia.io/docs/)
|
|
9
|
-
[](https://gurubase.io/g/nestia)
|
|
10
|
-
[](https://discord.gg/E94XhzrUCZ)
|
|
11
|
-
|
|
12
|
-
Nestia is a set of helper libraries for NestJS, supporting below features:
|
|
13
|
-
|
|
14
|
-
- `@nestia/core`:
|
|
15
|
-
- Super-fast/easy decorators
|
|
16
|
-
- Advanced WebSocket routes
|
|
17
|
-
- `@nestia/sdk`:
|
|
18
|
-
- Swagger generator, more evolved than ever
|
|
19
|
-
- SDK library generator for clients
|
|
20
|
-
- Mockup Simulator for client applications
|
|
21
|
-
- Automatic E2E test functions generator
|
|
22
|
-
- `@nestia/e2e`: Test program utilizing e2e test functions
|
|
23
|
-
- `@nestia/benchmark`: Benchmark program using e2e test functions
|
|
24
|
-
- `@nestia/editor`: Swagger-UI with Online TypeScript Editor
|
|
25
|
-
- [`@agentica`](https://github.com/wrtnlabs/agentica): Agentic AI library specialized in LLM function calling
|
|
26
|
-
- [`@autobe`](https://github.com/wrtnlabs/autobe): Vibe coding agent generating NestJS application
|
|
27
|
-
- `nestia`: Just CLI (command line interface) tool
|
|
28
|
-
|
|
29
|
-
> [!NOTE]
|
|
30
|
-
>
|
|
31
|
-
> - **Only one line** required, with pure TypeScript type
|
|
32
|
-
> - Enhance performance **30x** up
|
|
33
|
-
> - Runtime validator is **20,000x faster** than `class-validator`
|
|
34
|
-
> - JSON serialization is **200x faster** than `class-transformer`
|
|
35
|
-
> - Software Development Kit
|
|
36
|
-
> - Collection of typed `fetch` functions with DTO structures like [tRPC](https://trpc.io/)
|
|
37
|
-
> - Mockup simulator means embedded backend simulator in the SDK
|
|
38
|
-
> - similar with [msw](https://mswjs.io/), but fully automated
|
|
39
|
-
|
|
40
|
-

|
|
41
|
-
|
|
42
|
-
> Left is NestJS server code, and right is client (frontend) code utilizing SDK
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## Sponsors and Backers
|
|
48
|
-
Thanks for your support.
|
|
49
|
-
|
|
50
|
-
Your donation would encourage `nestia` development.
|
|
51
|
-
|
|
52
|
-
[](https://opencollective.com/nestia)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## Guide Documents
|
|
58
|
-
Check out the document in the [website](https://nestia.io/docs/):
|
|
59
|
-
|
|
60
|
-
### 🏠 Home
|
|
61
|
-
- [Introduction](https://nestia.io/docs/)
|
|
62
|
-
- [Setup](https://nestia.io/docs/setup/)
|
|
63
|
-
- [Pure TypeScript](https://nestia.io/docs/pure)
|
|
64
|
-
|
|
65
|
-
### 📖 Features
|
|
66
|
-
- Core Library
|
|
67
|
-
- [`@WebSocketRoute`](https://nestia.io/docs/core/WebSocketRoute)
|
|
68
|
-
- [`@TypedRoute`](https://nestia.io/docs/core/TypedRoute/)
|
|
69
|
-
- [**`@TypedBody`**](https://nestia.io/docs/core/TypedBody/)
|
|
70
|
-
- [`@TypedParam`](https://nestia.io/docs/core/TypedParam/)
|
|
71
|
-
- [`@TypedQuery`](https://nestia.io/docs/core/TypedQuery/)
|
|
72
|
-
- [`@TypedFormData`](https://nestia.io/docs/core/TypedFormData/)
|
|
73
|
-
- [`@TypedHeaders`](https://nestia.io/docs/core/TypedHeaders/)
|
|
74
|
-
- [`@TypedException`](https://nestia.io/docs/core/TypedException/)
|
|
75
|
-
- Software Development Kit
|
|
76
|
-
- [SDK Builder](https://nestia.io/docs/sdk/)
|
|
77
|
-
- [Mockup Simulator](https://nestia.io/docs/sdk/simulate/)
|
|
78
|
-
- [E2E Test Functions](https://nestia.io/docs/sdk/e2e/)
|
|
79
|
-
- [Distribution](https://nestia.io/docs/sdk/distribute/)
|
|
80
|
-
- Swagger Document
|
|
81
|
-
- [Swagger Builder](https://nestia.io/docs/swagger/)
|
|
82
|
-
- [**AI Chatbot Development**](https://nestia.io/docs/swagger/chat/)
|
|
83
|
-
- [Cloud Swagger Editor](https://nestia.io/docs/swagger/editor/)
|
|
84
|
-
- [Documentation Strategy](https://nestia.io/docs/swagger/strategy/)
|
|
85
|
-
- E2E Testing
|
|
86
|
-
- [Why E2E Test?](https://nestia.io/docs/e2e/why/)
|
|
87
|
-
- [Test Program Development](https://nestia.io/docs/e2e/development/)
|
|
88
|
-
- [Performance Benchmark](https://nestia.io/docs/e2e/benchmark/)
|
|
89
|
-
|
|
90
|
-
### 🔗 Appendix
|
|
91
|
-
- [API Documents](https://nestia.io/api)
|
|
92
|
-
- [⇲ Benchmark Result](https://github.com/samchon/nestia/tree/master/benchmark/results/11th%20Gen%20Intel(R)%20Core(TM)%20i5-1135G7%20%40%202.40GHz)
|
|
93
|
-
- [⇲ `dev.to` Articles](https://dev.to/samchon/series/22751)
|