koa-classic-server 1.1.0 → 2.0.0
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/BENCHMARKS.md +317 -0
- package/CHANGELOG.md +181 -0
- package/CREATE_RELEASE.sh +53 -0
- package/DEBUG_REPORT.md +593 -0
- package/DOCUMENTATION.md +1585 -0
- package/EXAMPLES_INDEX_OPTION.md +395 -0
- package/INDEX_OPTION_PRIORITY.md +527 -0
- package/LICENSE +21 -0
- package/OPTIMIZATION_HTTP_CACHING.md +687 -0
- package/PERFORMANCE_ANALYSIS.md +839 -0
- package/PERFORMANCE_COMPARISON.md +388 -0
- package/README.md +278 -103
- package/__tests__/index-option.test.js +447 -0
- package/__tests__/index.test.js +15 -11
- package/__tests__/performance.test.js +301 -0
- package/__tests__/publicWwwTest/cartella vuota con spazi nel nome/file con spazio nel nome .txt +1 -0
- package/__tests__/security.test.js +336 -0
- package/benchmark-results-baseline-v1.2.0.txt +354 -0
- package/benchmark-results-optimized-v2.0.0.txt +354 -0
- package/benchmark.js +239 -0
- package/demo-regex-index.js +140 -0
- package/index.cjs +386 -156
- package/jest.config.js +18 -0
- package/package.json +18 -5
- package/publish-to-npm.sh +65 -0
- package/scripts/setup-benchmark.js +178 -0
- package/test-regex-quick.js +158 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
|
|
2
|
+
> koa-classic-server@1.2.0 test:performance
|
|
3
|
+
> jest __tests__/performance.test.js --runInBand
|
|
4
|
+
|
|
5
|
+
console.log
|
|
6
|
+
|
|
7
|
+
📊 Small File (1KB) Benchmark:
|
|
8
|
+
|
|
9
|
+
at Object.log (__tests__/performance.test.js:90:21)
|
|
10
|
+
|
|
11
|
+
console.log
|
|
12
|
+
Average: 2.93ms
|
|
13
|
+
|
|
14
|
+
at Object.log (__tests__/performance.test.js:91:21)
|
|
15
|
+
|
|
16
|
+
console.log
|
|
17
|
+
Median: 2.54ms
|
|
18
|
+
|
|
19
|
+
at Object.log (__tests__/performance.test.js:92:21)
|
|
20
|
+
|
|
21
|
+
console.log
|
|
22
|
+
Min: 1.99ms
|
|
23
|
+
|
|
24
|
+
at Object.log (__tests__/performance.test.js:93:21)
|
|
25
|
+
|
|
26
|
+
console.log
|
|
27
|
+
Max: 26.87ms
|
|
28
|
+
|
|
29
|
+
at Object.log (__tests__/performance.test.js:94:21)
|
|
30
|
+
|
|
31
|
+
console.log
|
|
32
|
+
|
|
33
|
+
📊 Medium File (100KB) Benchmark:
|
|
34
|
+
|
|
35
|
+
at Object.log (__tests__/performance.test.js:109:21)
|
|
36
|
+
|
|
37
|
+
console.log
|
|
38
|
+
Average: 3.59ms
|
|
39
|
+
|
|
40
|
+
at Object.log (__tests__/performance.test.js:110:21)
|
|
41
|
+
|
|
42
|
+
console.log
|
|
43
|
+
Median: 3.51ms
|
|
44
|
+
|
|
45
|
+
at Object.log (__tests__/performance.test.js:111:21)
|
|
46
|
+
|
|
47
|
+
console.log
|
|
48
|
+
Min: 2.46ms
|
|
49
|
+
|
|
50
|
+
at Object.log (__tests__/performance.test.js:112:21)
|
|
51
|
+
|
|
52
|
+
console.log
|
|
53
|
+
Max: 8.36ms
|
|
54
|
+
|
|
55
|
+
at Object.log (__tests__/performance.test.js:113:21)
|
|
56
|
+
|
|
57
|
+
console.log
|
|
58
|
+
|
|
59
|
+
📊 Large File (1MB) Benchmark:
|
|
60
|
+
|
|
61
|
+
at Object.log (__tests__/performance.test.js:128:21)
|
|
62
|
+
|
|
63
|
+
console.log
|
|
64
|
+
Average: 9.03ms
|
|
65
|
+
|
|
66
|
+
at Object.log (__tests__/performance.test.js:129:21)
|
|
67
|
+
|
|
68
|
+
console.log
|
|
69
|
+
Median: 8.35ms
|
|
70
|
+
|
|
71
|
+
at Object.log (__tests__/performance.test.js:130:21)
|
|
72
|
+
|
|
73
|
+
console.log
|
|
74
|
+
Min: 5.46ms
|
|
75
|
+
|
|
76
|
+
at Object.log (__tests__/performance.test.js:131:21)
|
|
77
|
+
|
|
78
|
+
console.log
|
|
79
|
+
Max: 13.81ms
|
|
80
|
+
|
|
81
|
+
at Object.log (__tests__/performance.test.js:132:21)
|
|
82
|
+
|
|
83
|
+
console.log
|
|
84
|
+
|
|
85
|
+
📊 Small Directory (100 files) Benchmark:
|
|
86
|
+
|
|
87
|
+
at Object.log (__tests__/performance.test.js:150:21)
|
|
88
|
+
|
|
89
|
+
console.log
|
|
90
|
+
Average: 2.65ms
|
|
91
|
+
|
|
92
|
+
at Object.log (__tests__/performance.test.js:151:21)
|
|
93
|
+
|
|
94
|
+
console.log
|
|
95
|
+
Median: 2.54ms
|
|
96
|
+
|
|
97
|
+
at Object.log (__tests__/performance.test.js:152:21)
|
|
98
|
+
|
|
99
|
+
console.log
|
|
100
|
+
Min: 2.22ms
|
|
101
|
+
|
|
102
|
+
at Object.log (__tests__/performance.test.js:153:21)
|
|
103
|
+
|
|
104
|
+
console.log
|
|
105
|
+
Max: 4.69ms
|
|
106
|
+
|
|
107
|
+
at Object.log (__tests__/performance.test.js:154:21)
|
|
108
|
+
|
|
109
|
+
console.log
|
|
110
|
+
|
|
111
|
+
📊 Large Directory (1,000 files) Benchmark:
|
|
112
|
+
|
|
113
|
+
at Object.log (__tests__/performance.test.js:168:21)
|
|
114
|
+
|
|
115
|
+
console.log
|
|
116
|
+
Average: 9.23ms
|
|
117
|
+
|
|
118
|
+
at Object.log (__tests__/performance.test.js:169:21)
|
|
119
|
+
|
|
120
|
+
console.log
|
|
121
|
+
Median: 9.14ms
|
|
122
|
+
|
|
123
|
+
at Object.log (__tests__/performance.test.js:170:21)
|
|
124
|
+
|
|
125
|
+
console.log
|
|
126
|
+
Min: 8.26ms
|
|
127
|
+
|
|
128
|
+
at Object.log (__tests__/performance.test.js:171:21)
|
|
129
|
+
|
|
130
|
+
console.log
|
|
131
|
+
Max: 11.64ms
|
|
132
|
+
|
|
133
|
+
at Object.log (__tests__/performance.test.js:172:21)
|
|
134
|
+
|
|
135
|
+
console.log
|
|
136
|
+
⚠️ WARNING: This will be MUCH faster after async optimization
|
|
137
|
+
|
|
138
|
+
at Object.log (__tests__/performance.test.js:175:21)
|
|
139
|
+
|
|
140
|
+
console.log
|
|
141
|
+
|
|
142
|
+
📊 Very Large Directory (10,000 files) Benchmark:
|
|
143
|
+
|
|
144
|
+
at Object.log (__tests__/performance.test.js:189:21)
|
|
145
|
+
|
|
146
|
+
console.log
|
|
147
|
+
Average: 102.37ms
|
|
148
|
+
|
|
149
|
+
at Object.log (__tests__/performance.test.js:190:21)
|
|
150
|
+
|
|
151
|
+
console.log
|
|
152
|
+
Median: 95.13ms
|
|
153
|
+
|
|
154
|
+
at Object.log (__tests__/performance.test.js:191:21)
|
|
155
|
+
|
|
156
|
+
console.log
|
|
157
|
+
Min: 90.91ms
|
|
158
|
+
|
|
159
|
+
at Object.log (__tests__/performance.test.js:192:21)
|
|
160
|
+
|
|
161
|
+
console.log
|
|
162
|
+
Max: 120.85ms
|
|
163
|
+
|
|
164
|
+
at Object.log (__tests__/performance.test.js:193:21)
|
|
165
|
+
|
|
166
|
+
console.log
|
|
167
|
+
⚠️ WARNING: Event loop BLOCKED during this operation!
|
|
168
|
+
|
|
169
|
+
at Object.log (__tests__/performance.test.js:194:21)
|
|
170
|
+
|
|
171
|
+
console.log
|
|
172
|
+
⚠️ Expected to drop to ~30.71ms after optimization
|
|
173
|
+
|
|
174
|
+
at Object.log (__tests__/performance.test.js:195:21)
|
|
175
|
+
|
|
176
|
+
console.log
|
|
177
|
+
|
|
178
|
+
📊 10 Concurrent Small Files:
|
|
179
|
+
|
|
180
|
+
at Object.log (__tests__/performance.test.js:212:21)
|
|
181
|
+
|
|
182
|
+
console.log
|
|
183
|
+
Total time: 15.50ms
|
|
184
|
+
|
|
185
|
+
at Object.log (__tests__/performance.test.js:213:21)
|
|
186
|
+
|
|
187
|
+
console.log
|
|
188
|
+
Avg per request: 1.55ms
|
|
189
|
+
|
|
190
|
+
at Object.log (__tests__/performance.test.js:214:21)
|
|
191
|
+
|
|
192
|
+
console.log
|
|
193
|
+
|
|
194
|
+
📊 5 Concurrent Directory Listings (100 files):
|
|
195
|
+
|
|
196
|
+
at Object.log (__tests__/performance.test.js:231:21)
|
|
197
|
+
|
|
198
|
+
console.log
|
|
199
|
+
Total time: 11.30ms
|
|
200
|
+
|
|
201
|
+
at Object.log (__tests__/performance.test.js:232:21)
|
|
202
|
+
|
|
203
|
+
console.log
|
|
204
|
+
Avg per request: 2.26ms
|
|
205
|
+
|
|
206
|
+
at Object.log (__tests__/performance.test.js:233:21)
|
|
207
|
+
|
|
208
|
+
console.log
|
|
209
|
+
⚠️ With current sync code, these run SEQUENTIALLY
|
|
210
|
+
|
|
211
|
+
at Object.log (__tests__/performance.test.js:234:21)
|
|
212
|
+
|
|
213
|
+
console.log
|
|
214
|
+
⚠️ After async optimization, will run in PARALLEL
|
|
215
|
+
|
|
216
|
+
at Object.log (__tests__/performance.test.js:235:21)
|
|
217
|
+
|
|
218
|
+
console.log
|
|
219
|
+
|
|
220
|
+
📊 404 Not Found Benchmark:
|
|
221
|
+
|
|
222
|
+
at Object.log (__tests__/performance.test.js:252:21)
|
|
223
|
+
|
|
224
|
+
console.log
|
|
225
|
+
Average: 1.26ms
|
|
226
|
+
|
|
227
|
+
at Object.log (__tests__/performance.test.js:253:21)
|
|
228
|
+
|
|
229
|
+
console.log
|
|
230
|
+
Median: 1.24ms
|
|
231
|
+
|
|
232
|
+
at Object.log (__tests__/performance.test.js:254:21)
|
|
233
|
+
|
|
234
|
+
console.log
|
|
235
|
+
Min: 1.05ms
|
|
236
|
+
|
|
237
|
+
at Object.log (__tests__/performance.test.js:255:21)
|
|
238
|
+
|
|
239
|
+
console.log
|
|
240
|
+
Max: 2.17ms
|
|
241
|
+
|
|
242
|
+
at Object.log (__tests__/performance.test.js:256:21)
|
|
243
|
+
|
|
244
|
+
console.log
|
|
245
|
+
|
|
246
|
+
📊 Memory Usage (10,000 files directory):
|
|
247
|
+
|
|
248
|
+
at Object.log (__tests__/performance.test.js:278:21)
|
|
249
|
+
|
|
250
|
+
console.log
|
|
251
|
+
Heap used increase: 1.16 MB
|
|
252
|
+
|
|
253
|
+
at Object.log (__tests__/performance.test.js:279:21)
|
|
254
|
+
|
|
255
|
+
console.log
|
|
256
|
+
External increase: 2.57 MB
|
|
257
|
+
|
|
258
|
+
at Object.log (__tests__/performance.test.js:280:21)
|
|
259
|
+
|
|
260
|
+
console.log
|
|
261
|
+
Response size: 1.29 MB
|
|
262
|
+
|
|
263
|
+
at Object.log (__tests__/performance.test.js:281:21)
|
|
264
|
+
|
|
265
|
+
console.log
|
|
266
|
+
⚠️ Expected to reduce by ~30-40% after optimization
|
|
267
|
+
|
|
268
|
+
at Object.log (__tests__/performance.test.js:282:21)
|
|
269
|
+
|
|
270
|
+
console.log
|
|
271
|
+
|
|
272
|
+
======================================================================
|
|
273
|
+
|
|
274
|
+
at Object.log (__tests__/performance.test.js:289:13)
|
|
275
|
+
|
|
276
|
+
console.log
|
|
277
|
+
📋 BASELINE BENCHMARK SUMMARY
|
|
278
|
+
|
|
279
|
+
at Object.log (__tests__/performance.test.js:290:13)
|
|
280
|
+
|
|
281
|
+
console.log
|
|
282
|
+
======================================================================
|
|
283
|
+
|
|
284
|
+
at Object.log (__tests__/performance.test.js:291:13)
|
|
285
|
+
|
|
286
|
+
console.log
|
|
287
|
+
|
|
288
|
+
These results represent the CURRENT performance (v1.2.0)
|
|
289
|
+
|
|
290
|
+
at Object.log (__tests__/performance.test.js:292:13)
|
|
291
|
+
|
|
292
|
+
console.log
|
|
293
|
+
After implementing optimizations, run this test again to see improvements.
|
|
294
|
+
|
|
295
|
+
at Object.log (__tests__/performance.test.js:293:13)
|
|
296
|
+
|
|
297
|
+
console.log
|
|
298
|
+
Expected improvements after optimization:
|
|
299
|
+
|
|
300
|
+
at Object.log (__tests__/performance.test.js:294:13)
|
|
301
|
+
|
|
302
|
+
console.log
|
|
303
|
+
✓ Small files: 10-20% faster (async operations)
|
|
304
|
+
|
|
305
|
+
at Object.log (__tests__/performance.test.js:295:13)
|
|
306
|
+
|
|
307
|
+
console.log
|
|
308
|
+
✓ Large directories: 50-70% faster (async + array join)
|
|
309
|
+
|
|
310
|
+
at Object.log (__tests__/performance.test.js:296:13)
|
|
311
|
+
|
|
312
|
+
console.log
|
|
313
|
+
✓ Concurrent requests: 5-10x faster (non-blocking event loop)
|
|
314
|
+
|
|
315
|
+
at Object.log (__tests__/performance.test.js:297:13)
|
|
316
|
+
|
|
317
|
+
console.log
|
|
318
|
+
✓ Memory usage: 30-40% reduction (array join vs concatenation)
|
|
319
|
+
|
|
320
|
+
at Object.log (__tests__/performance.test.js:298:13)
|
|
321
|
+
|
|
322
|
+
console.log
|
|
323
|
+
✓ With HTTP caching: 80-95% faster (304 responses)
|
|
324
|
+
|
|
325
|
+
at Object.log (__tests__/performance.test.js:299:13)
|
|
326
|
+
|
|
327
|
+
console.log
|
|
328
|
+
======================================================================
|
|
329
|
+
|
|
330
|
+
at Object.log (__tests__/performance.test.js:300:13)
|
|
331
|
+
|
|
332
|
+
PASS __tests__/performance.test.js
|
|
333
|
+
Performance Benchmarks - BASELINE (v1.2.0)
|
|
334
|
+
File Serving Performance
|
|
335
|
+
✓ Benchmark: Small file (1KB) - 100 iterations (318 ms)
|
|
336
|
+
✓ Benchmark: Medium file (100KB) - 50 iterations (184 ms)
|
|
337
|
+
✓ Benchmark: Large file (1MB) - 20 iterations (183 ms)
|
|
338
|
+
Directory Listing Performance
|
|
339
|
+
✓ Benchmark: Small directory (100 files) - 50 iterations (135 ms)
|
|
340
|
+
✓ Benchmark: Large directory (1,000 files) - 20 iterations (188 ms)
|
|
341
|
+
✓ Benchmark: Very large directory (10,000 files) - 5 iterations (515 ms)
|
|
342
|
+
Concurrent Request Performance
|
|
343
|
+
✓ Benchmark: 10 concurrent small file requests (18 ms)
|
|
344
|
+
✓ Benchmark: 5 concurrent directory listings (100 files each) (14 ms)
|
|
345
|
+
404 Not Found Performance
|
|
346
|
+
✓ Benchmark: Non-existent file - 50 iterations (66 ms)
|
|
347
|
+
Memory Usage (Informational)
|
|
348
|
+
✓ Memory usage during large directory listing (88 ms)
|
|
349
|
+
|
|
350
|
+
Test Suites: 1 passed, 1 total
|
|
351
|
+
Tests: 10 passed, 10 total
|
|
352
|
+
Snapshots: 0 total
|
|
353
|
+
Time: 3.227 s, estimated 4 s
|
|
354
|
+
Ran all test suites matching /__tests__\/performance.test.js/i.
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
|
|
2
|
+
> koa-classic-server@1.2.0 test:performance
|
|
3
|
+
> jest __tests__/performance.test.js --runInBand
|
|
4
|
+
|
|
5
|
+
console.log
|
|
6
|
+
|
|
7
|
+
📊 Small File (1KB) Benchmark:
|
|
8
|
+
|
|
9
|
+
at Object.log (__tests__/performance.test.js:90:21)
|
|
10
|
+
|
|
11
|
+
console.log
|
|
12
|
+
Average: 2.93ms
|
|
13
|
+
|
|
14
|
+
at Object.log (__tests__/performance.test.js:91:21)
|
|
15
|
+
|
|
16
|
+
console.log
|
|
17
|
+
Median: 2.48ms
|
|
18
|
+
|
|
19
|
+
at Object.log (__tests__/performance.test.js:92:21)
|
|
20
|
+
|
|
21
|
+
console.log
|
|
22
|
+
Min: 1.90ms
|
|
23
|
+
|
|
24
|
+
at Object.log (__tests__/performance.test.js:93:21)
|
|
25
|
+
|
|
26
|
+
console.log
|
|
27
|
+
Max: 25.14ms
|
|
28
|
+
|
|
29
|
+
at Object.log (__tests__/performance.test.js:94:21)
|
|
30
|
+
|
|
31
|
+
console.log
|
|
32
|
+
|
|
33
|
+
📊 Medium File (100KB) Benchmark:
|
|
34
|
+
|
|
35
|
+
at Object.log (__tests__/performance.test.js:109:21)
|
|
36
|
+
|
|
37
|
+
console.log
|
|
38
|
+
Average: 3.13ms
|
|
39
|
+
|
|
40
|
+
at Object.log (__tests__/performance.test.js:110:21)
|
|
41
|
+
|
|
42
|
+
console.log
|
|
43
|
+
Median: 3.15ms
|
|
44
|
+
|
|
45
|
+
at Object.log (__tests__/performance.test.js:111:21)
|
|
46
|
+
|
|
47
|
+
console.log
|
|
48
|
+
Min: 2.31ms
|
|
49
|
+
|
|
50
|
+
at Object.log (__tests__/performance.test.js:112:21)
|
|
51
|
+
|
|
52
|
+
console.log
|
|
53
|
+
Max: 4.11ms
|
|
54
|
+
|
|
55
|
+
at Object.log (__tests__/performance.test.js:113:21)
|
|
56
|
+
|
|
57
|
+
console.log
|
|
58
|
+
|
|
59
|
+
📊 Large File (1MB) Benchmark:
|
|
60
|
+
|
|
61
|
+
at Object.log (__tests__/performance.test.js:128:21)
|
|
62
|
+
|
|
63
|
+
console.log
|
|
64
|
+
Average: 8.76ms
|
|
65
|
+
|
|
66
|
+
at Object.log (__tests__/performance.test.js:129:21)
|
|
67
|
+
|
|
68
|
+
console.log
|
|
69
|
+
Median: 9.85ms
|
|
70
|
+
|
|
71
|
+
at Object.log (__tests__/performance.test.js:130:21)
|
|
72
|
+
|
|
73
|
+
console.log
|
|
74
|
+
Min: 5.79ms
|
|
75
|
+
|
|
76
|
+
at Object.log (__tests__/performance.test.js:131:21)
|
|
77
|
+
|
|
78
|
+
console.log
|
|
79
|
+
Max: 11.72ms
|
|
80
|
+
|
|
81
|
+
at Object.log (__tests__/performance.test.js:132:21)
|
|
82
|
+
|
|
83
|
+
console.log
|
|
84
|
+
|
|
85
|
+
📊 Small Directory (100 files) Benchmark:
|
|
86
|
+
|
|
87
|
+
at Object.log (__tests__/performance.test.js:150:21)
|
|
88
|
+
|
|
89
|
+
console.log
|
|
90
|
+
Average: 2.68ms
|
|
91
|
+
|
|
92
|
+
at Object.log (__tests__/performance.test.js:151:21)
|
|
93
|
+
|
|
94
|
+
console.log
|
|
95
|
+
Median: 2.53ms
|
|
96
|
+
|
|
97
|
+
at Object.log (__tests__/performance.test.js:152:21)
|
|
98
|
+
|
|
99
|
+
console.log
|
|
100
|
+
Min: 2.22ms
|
|
101
|
+
|
|
102
|
+
at Object.log (__tests__/performance.test.js:153:21)
|
|
103
|
+
|
|
104
|
+
console.log
|
|
105
|
+
Max: 4.79ms
|
|
106
|
+
|
|
107
|
+
at Object.log (__tests__/performance.test.js:154:21)
|
|
108
|
+
|
|
109
|
+
console.log
|
|
110
|
+
|
|
111
|
+
📊 Large Directory (1,000 files) Benchmark:
|
|
112
|
+
|
|
113
|
+
at Object.log (__tests__/performance.test.js:168:21)
|
|
114
|
+
|
|
115
|
+
console.log
|
|
116
|
+
Average: 9.49ms
|
|
117
|
+
|
|
118
|
+
at Object.log (__tests__/performance.test.js:169:21)
|
|
119
|
+
|
|
120
|
+
console.log
|
|
121
|
+
Median: 9.16ms
|
|
122
|
+
|
|
123
|
+
at Object.log (__tests__/performance.test.js:170:21)
|
|
124
|
+
|
|
125
|
+
console.log
|
|
126
|
+
Min: 8.20ms
|
|
127
|
+
|
|
128
|
+
at Object.log (__tests__/performance.test.js:171:21)
|
|
129
|
+
|
|
130
|
+
console.log
|
|
131
|
+
Max: 11.49ms
|
|
132
|
+
|
|
133
|
+
at Object.log (__tests__/performance.test.js:172:21)
|
|
134
|
+
|
|
135
|
+
console.log
|
|
136
|
+
⚠️ WARNING: This will be MUCH faster after async optimization
|
|
137
|
+
|
|
138
|
+
at Object.log (__tests__/performance.test.js:175:21)
|
|
139
|
+
|
|
140
|
+
console.log
|
|
141
|
+
|
|
142
|
+
📊 Very Large Directory (10,000 files) Benchmark:
|
|
143
|
+
|
|
144
|
+
at Object.log (__tests__/performance.test.js:189:21)
|
|
145
|
+
|
|
146
|
+
console.log
|
|
147
|
+
Average: 90.06ms
|
|
148
|
+
|
|
149
|
+
at Object.log (__tests__/performance.test.js:190:21)
|
|
150
|
+
|
|
151
|
+
console.log
|
|
152
|
+
Median: 90.14ms
|
|
153
|
+
|
|
154
|
+
at Object.log (__tests__/performance.test.js:191:21)
|
|
155
|
+
|
|
156
|
+
console.log
|
|
157
|
+
Min: 87.00ms
|
|
158
|
+
|
|
159
|
+
at Object.log (__tests__/performance.test.js:192:21)
|
|
160
|
+
|
|
161
|
+
console.log
|
|
162
|
+
Max: 93.29ms
|
|
163
|
+
|
|
164
|
+
at Object.log (__tests__/performance.test.js:193:21)
|
|
165
|
+
|
|
166
|
+
console.log
|
|
167
|
+
⚠️ WARNING: Event loop BLOCKED during this operation!
|
|
168
|
+
|
|
169
|
+
at Object.log (__tests__/performance.test.js:194:21)
|
|
170
|
+
|
|
171
|
+
console.log
|
|
172
|
+
⚠️ Expected to drop to ~27.02ms after optimization
|
|
173
|
+
|
|
174
|
+
at Object.log (__tests__/performance.test.js:195:21)
|
|
175
|
+
|
|
176
|
+
console.log
|
|
177
|
+
|
|
178
|
+
📊 10 Concurrent Small Files:
|
|
179
|
+
|
|
180
|
+
at Object.log (__tests__/performance.test.js:212:21)
|
|
181
|
+
|
|
182
|
+
console.log
|
|
183
|
+
Total time: 14.35ms
|
|
184
|
+
|
|
185
|
+
at Object.log (__tests__/performance.test.js:213:21)
|
|
186
|
+
|
|
187
|
+
console.log
|
|
188
|
+
Avg per request: 1.43ms
|
|
189
|
+
|
|
190
|
+
at Object.log (__tests__/performance.test.js:214:21)
|
|
191
|
+
|
|
192
|
+
console.log
|
|
193
|
+
|
|
194
|
+
📊 5 Concurrent Directory Listings (100 files):
|
|
195
|
+
|
|
196
|
+
at Object.log (__tests__/performance.test.js:231:21)
|
|
197
|
+
|
|
198
|
+
console.log
|
|
199
|
+
Total time: 7.26ms
|
|
200
|
+
|
|
201
|
+
at Object.log (__tests__/performance.test.js:232:21)
|
|
202
|
+
|
|
203
|
+
console.log
|
|
204
|
+
Avg per request: 1.45ms
|
|
205
|
+
|
|
206
|
+
at Object.log (__tests__/performance.test.js:233:21)
|
|
207
|
+
|
|
208
|
+
console.log
|
|
209
|
+
⚠️ With current sync code, these run SEQUENTIALLY
|
|
210
|
+
|
|
211
|
+
at Object.log (__tests__/performance.test.js:234:21)
|
|
212
|
+
|
|
213
|
+
console.log
|
|
214
|
+
⚠️ After async optimization, will run in PARALLEL
|
|
215
|
+
|
|
216
|
+
at Object.log (__tests__/performance.test.js:235:21)
|
|
217
|
+
|
|
218
|
+
console.log
|
|
219
|
+
|
|
220
|
+
📊 404 Not Found Benchmark:
|
|
221
|
+
|
|
222
|
+
at Object.log (__tests__/performance.test.js:252:21)
|
|
223
|
+
|
|
224
|
+
console.log
|
|
225
|
+
Average: 1.53ms
|
|
226
|
+
|
|
227
|
+
at Object.log (__tests__/performance.test.js:253:21)
|
|
228
|
+
|
|
229
|
+
console.log
|
|
230
|
+
Median: 1.43ms
|
|
231
|
+
|
|
232
|
+
at Object.log (__tests__/performance.test.js:254:21)
|
|
233
|
+
|
|
234
|
+
console.log
|
|
235
|
+
Min: 1.24ms
|
|
236
|
+
|
|
237
|
+
at Object.log (__tests__/performance.test.js:255:21)
|
|
238
|
+
|
|
239
|
+
console.log
|
|
240
|
+
Max: 3.80ms
|
|
241
|
+
|
|
242
|
+
at Object.log (__tests__/performance.test.js:256:21)
|
|
243
|
+
|
|
244
|
+
console.log
|
|
245
|
+
|
|
246
|
+
📊 Memory Usage (10,000 files directory):
|
|
247
|
+
|
|
248
|
+
at Object.log (__tests__/performance.test.js:278:21)
|
|
249
|
+
|
|
250
|
+
console.log
|
|
251
|
+
Heap used increase: 0.96 MB
|
|
252
|
+
|
|
253
|
+
at Object.log (__tests__/performance.test.js:279:21)
|
|
254
|
+
|
|
255
|
+
console.log
|
|
256
|
+
External increase: 2.54 MB
|
|
257
|
+
|
|
258
|
+
at Object.log (__tests__/performance.test.js:280:21)
|
|
259
|
+
|
|
260
|
+
console.log
|
|
261
|
+
Response size: 1.29 MB
|
|
262
|
+
|
|
263
|
+
at Object.log (__tests__/performance.test.js:281:21)
|
|
264
|
+
|
|
265
|
+
console.log
|
|
266
|
+
⚠️ Expected to reduce by ~30-40% after optimization
|
|
267
|
+
|
|
268
|
+
at Object.log (__tests__/performance.test.js:282:21)
|
|
269
|
+
|
|
270
|
+
console.log
|
|
271
|
+
|
|
272
|
+
======================================================================
|
|
273
|
+
|
|
274
|
+
at Object.log (__tests__/performance.test.js:289:13)
|
|
275
|
+
|
|
276
|
+
console.log
|
|
277
|
+
📋 BASELINE BENCHMARK SUMMARY
|
|
278
|
+
|
|
279
|
+
at Object.log (__tests__/performance.test.js:290:13)
|
|
280
|
+
|
|
281
|
+
console.log
|
|
282
|
+
======================================================================
|
|
283
|
+
|
|
284
|
+
at Object.log (__tests__/performance.test.js:291:13)
|
|
285
|
+
|
|
286
|
+
console.log
|
|
287
|
+
|
|
288
|
+
These results represent the CURRENT performance (v1.2.0)
|
|
289
|
+
|
|
290
|
+
at Object.log (__tests__/performance.test.js:292:13)
|
|
291
|
+
|
|
292
|
+
console.log
|
|
293
|
+
After implementing optimizations, run this test again to see improvements.
|
|
294
|
+
|
|
295
|
+
at Object.log (__tests__/performance.test.js:293:13)
|
|
296
|
+
|
|
297
|
+
console.log
|
|
298
|
+
Expected improvements after optimization:
|
|
299
|
+
|
|
300
|
+
at Object.log (__tests__/performance.test.js:294:13)
|
|
301
|
+
|
|
302
|
+
console.log
|
|
303
|
+
✓ Small files: 10-20% faster (async operations)
|
|
304
|
+
|
|
305
|
+
at Object.log (__tests__/performance.test.js:295:13)
|
|
306
|
+
|
|
307
|
+
console.log
|
|
308
|
+
✓ Large directories: 50-70% faster (async + array join)
|
|
309
|
+
|
|
310
|
+
at Object.log (__tests__/performance.test.js:296:13)
|
|
311
|
+
|
|
312
|
+
console.log
|
|
313
|
+
✓ Concurrent requests: 5-10x faster (non-blocking event loop)
|
|
314
|
+
|
|
315
|
+
at Object.log (__tests__/performance.test.js:297:13)
|
|
316
|
+
|
|
317
|
+
console.log
|
|
318
|
+
✓ Memory usage: 30-40% reduction (array join vs concatenation)
|
|
319
|
+
|
|
320
|
+
at Object.log (__tests__/performance.test.js:298:13)
|
|
321
|
+
|
|
322
|
+
console.log
|
|
323
|
+
✓ With HTTP caching: 80-95% faster (304 responses)
|
|
324
|
+
|
|
325
|
+
at Object.log (__tests__/performance.test.js:299:13)
|
|
326
|
+
|
|
327
|
+
console.log
|
|
328
|
+
======================================================================
|
|
329
|
+
|
|
330
|
+
at Object.log (__tests__/performance.test.js:300:13)
|
|
331
|
+
|
|
332
|
+
PASS __tests__/performance.test.js
|
|
333
|
+
Performance Benchmarks - BASELINE (v1.2.0)
|
|
334
|
+
File Serving Performance
|
|
335
|
+
✓ Benchmark: Small file (1KB) - 100 iterations (322 ms)
|
|
336
|
+
✓ Benchmark: Medium file (100KB) - 50 iterations (160 ms)
|
|
337
|
+
✓ Benchmark: Large file (1MB) - 20 iterations (178 ms)
|
|
338
|
+
Directory Listing Performance
|
|
339
|
+
✓ Benchmark: Small directory (100 files) - 50 iterations (136 ms)
|
|
340
|
+
✓ Benchmark: Large directory (1,000 files) - 20 iterations (192 ms)
|
|
341
|
+
✓ Benchmark: Very large directory (10,000 files) - 5 iterations (454 ms)
|
|
342
|
+
Concurrent Request Performance
|
|
343
|
+
✓ Benchmark: 10 concurrent small file requests (17 ms)
|
|
344
|
+
✓ Benchmark: 5 concurrent directory listings (100 files each) (9 ms)
|
|
345
|
+
404 Not Found Performance
|
|
346
|
+
✓ Benchmark: Non-existent file - 50 iterations (79 ms)
|
|
347
|
+
Memory Usage (Informational)
|
|
348
|
+
✓ Memory usage during large directory listing (90 ms)
|
|
349
|
+
|
|
350
|
+
Test Suites: 1 passed, 1 total
|
|
351
|
+
Tests: 10 passed, 10 total
|
|
352
|
+
Snapshots: 0 total
|
|
353
|
+
Time: 2.781 s, estimated 4 s
|
|
354
|
+
Ran all test suites matching /__tests__\/performance.test.js/i.
|