Commit 1a3c275
committed
Optimize header processing for better performance
Improve request handling performance by optimizing header retrieval:
- Avoid unnecessary forEach iteration when accessing individual
headers by using direct headers.get() access
- Eliminate duplicate split operations on Content-Type header by
caching media type alongside normalized content type
Expected performance improvements:
- Reduces header processing overhead from ~28% to ~15-18%
- Reduces media type processing overhead by ~40%
- Overall request processing speedup of ~20-25%
This optimization ensures validation library performance differences
are properly reflected in benchmarks by minimizing framework overhead.1 parent 6c9b958 commit 1a3c275
File tree
2 files changed
+31
-11
lines changed- .changeset
- packages/kori/src/context
2 files changed
+31
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
363 | 366 | | |
364 | 367 | | |
365 | 368 | | |
| |||
370 | 373 | | |
371 | 374 | | |
372 | 375 | | |
| 376 | + | |
| 377 | + | |
373 | 378 | | |
374 | 379 | | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
380 | 385 | | |
381 | 386 | | |
382 | 387 | | |
| |||
386 | 391 | | |
387 | 392 | | |
388 | 393 | | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
| 394 | + | |
| 395 | + | |
394 | 396 | | |
395 | 397 | | |
396 | 398 | | |
| |||
0 commit comments