Skip to content

perf: Reduce internal overhead to increase request throughput by ~1.5-3x#3

Merged
aklinker1 merged 18 commits intomainfrom
performance
Dec 26, 2025
Merged

perf: Reduce internal overhead to increase request throughput by ~1.5-3x#3
aklinker1 merged 18 commits intomainfrom
performance

Conversation

@aklinker1
Copy link
Copy Markdown
Owner

@aklinker1 aklinker1 commented Dec 26, 2025

I updated the src/__tests__/bench.ts file to individually test each "component" of Zeta's call handler.

Static Response:
┌───┬────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│   │ Task name  │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├───┼────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0 │ vanilla    │ 256.19 ± 0.40%   │ 187.00 ± 5.00    │ 5154944 ± 0.02%        │ 5347594 ± 139260       │ 3903327 │
│ 1 │ elysia     │ 368.16 ± 0.46%   │ 267.00 ± 8.00    │ 3532917 ± 0.02%        │ 3745318 ± 115685       │ 2716219 │
│ 2 │ hono       │ 1664.6 ± 0.69%   │ 1128.0 ± 59.00   │ 771075 ± 0.07%         │ 886525 ± 48055         │ 600751  │
│ 3 │ zeta (OLD) │ 3908.7 ± 2.25%   │ 3066.0 ± 169.00  │ 306867 ± 0.07%         │ 326158 ± 18432         │ 255838  │
│ 4 │ zeta (NEW) │ 1537.3 ± 0.48%   │ 1256.0 ± 58.00   │ 746441 ± 0.05%         │ 796178 ± 37453         │ 650829  │
└───┴────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
Validate and Echo JSON Body:
┌───┬────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│   │ Task name  │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├───┼────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0 │ vanilla    │ 348.68 ± 0.36%   │ 309.00 ± 10.00   │ 3165416 ± 0.01%        │ 3236246 ± 101450       │ 2867932 │
│ 1 │ elysia     │ 1547.7 ± 1.17%   │ 1261.0 ± 53.00   │ 763108 ± 0.04%         │ 793021 ± 34108         │ 646136  │
│ 2 │ hono       │ 1854.1 ± 0.87%   │ 1411.0 ± 71.00   │ 643923 ± 0.06%         │ 708717 ± 36674         │ 539347  │
│ 3 │ zeta (OLD) │ 5273.9 ± 0.76%   │ 4279.0 ± 198.00  │ 221479 ± 0.08%         │ 233699 ± 11032         │ 189613  │
│ 4 │ zeta (NEW) │ 3164.7 ± 0.88%   │ 2650.0 ± 104.00  │ 359914 ± 0.05%         │ 377358 ± 15106         │ 315984  │
└───┴────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
Validate and Echo Query Params:
┌───┬────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│   │ Task name  │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├───┼────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0 │ vanilla    │ 1925.2 ± 2.27%   │ 1285.0 ± 71.00   │ 726798 ± 0.06%         │ 778210 ± 44158         │ 519438  │
│ 1 │ elysia     │ 723.28 ± 0.56%   │ 574.00 ± 32.00   │ 1636262 ± 0.03%        │ 1742160 ± 99460        │ 1382601 │
│ 2 │ hono       │ 3445.0 ± 1.24%   │ 2607.0 ± 143.00  │ 351154 ± 0.08%         │ 383583 ± 21932         │ 290274  │
│ 3 │ zeta (OLD) │ 5870.1 ± 2.84%   │ 4566.0 ± 236.00  │ 207398 ± 0.09%         │ 219010 ± 11564         │ 170356  │
│ 4 │ zeta (NEW) │ 2687.9 ± 0.54%   │ 2278.0 ± 96.00   │ 415459 ± 0.05%         │ 438982 ± 18894         │ 372044  │
└───┴────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
Validate and Echo Path Params:
┌───┬────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│   │ Task name  │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├───┼────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0 │ elysia     │ 453.29 ± 0.82%   │ 342.00 ± 26.00   │ 2721230 ± 0.03%        │ 2923977 ± 230597       │ 2206116 │
│ 1 │ hono       │ 3834.2 ± 1.03%   │ 2933.0 ± 191.00  │ 314194 ± 0.08%         │ 340948 ± 23086         │ 260813  │
│ 2 │ zeta (OLD) │ 5632.8 ± 2.78%   │ 4431.0 ± 232.00  │ 213037 ± 0.09%         │ 225683 ± 12073         │ 177534  │
│ 4 │ zeta (NEW) │ 3155.5 ± 0.50%   │ 2671.0 ± 122.00  │ 356164 ± 0.06%         │ 374392 ± 17458         │ 316903  │
└───┴────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
Response Validation:
┌───┬────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│   │ Task name  │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├───┼────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0 │ vanilla    │ 832.20 ± 0.60%   │ 570.00 ± 29.00   │ 1641814 ± 0.04%        │ 1754386 ± 90632        │ 1201650 │
│ 1 │ elysia     │ 386.75 ± 0.94%   │ 296.00 ± 25.00   │ 3138045 ± 0.03%        │ 3378378 ± 298092       │ 2585665 │
│ 2 │ hono       │ 2989.5 ± 0.91%   │ 2246.0 ± 128.00  │ 409342 ± 0.07%         │ 445236 ± 26240         │ 334503  │
│ 3 │ zeta (OLD) │ 4698.6 ± 2.76%   │ 3710.0 ± 188.00  │ 255058 ± 0.08%         │ 269542 ± 13985         │ 212828  │
│ 4 │ zeta (NEW) │ 2222.6 ± 0.67%   │ 1901.0 ± 77.00   │ 500108 ± 0.04%         │ 526039 ± 21606         │ 449915  │
└───┴────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘
Single hook:
┌───┬────────────┬──────────────────┬──────────────────┬────────────────────────┬────────────────────────┬─────────┐
│   │ Task name  │ Latency avg (ns) │ Latency med (ns) │ Throughput avg (ops/s) │ Throughput med (ops/s) │ Samples │
├───┼────────────┼──────────────────┼──────────────────┼────────────────────────┼────────────────────────┼─────────┤
│ 0 │ elysia     │ 245.87 ± 0.47%   │ 205.00 ± 10.00   │ 4699540 ± 0.02%        │ 4878049 ± 248419       │ 4069503 │
│ 1 │ hono       │ 3713.5 ± 1.43%   │ 2816.0 ± 256.00  │ 325920 ± 0.09%         │ 355114 ± 33880         │ 269289  │
│ 2 │ zeta (OLD) │ 5139.3 ± 2.68%   │ 4232.0 ± 211.00  │ 225903 ± 0.07%         │ 236295 ± 12080         │ 194578  │
│ 3 │ zeta (NEW) │ 2877.0 ± 0.47%   │ 2428.0 ± 131.00  │ 388803 ± 0.06%         │ 411862 ± 22732         │ 347579  │
└───┴────────────┴──────────────────┴──────────────────┴────────────────────────┴────────────────────────┴─────────┘

@aklinker1 aklinker1 changed the title perf: Optimize call handler to speed up requests per second the framework can handle perf: Improve request throughput by 2-3x Dec 26, 2025
@aklinker1 aklinker1 changed the title perf: Improve request throughput by 2-3x perf: Improve request throughput by ~1.5-3x Dec 26, 2025
@aklinker1 aklinker1 changed the title perf: Improve request throughput by ~1.5-3x perf: Reduce internal overhead to increase request throughput by ~1.5-3x Dec 26, 2025
@aklinker1 aklinker1 marked this pull request as ready for review December 26, 2025 20:29
@aklinker1 aklinker1 merged commit 187229d into main Dec 26, 2025
2 checks passed
@aklinker1 aklinker1 deleted the performance branch December 26, 2025 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant