Commit bd15c6b
committed
TUN-3208: Reduce copies and allocations on h2mux write path. Pre-allocate 16KB write buffer on the first write if possible. Use explicit byte array for chunks on write thread to avoid copying through intermediate buffer due to io.CopyN.
benchmark old ns/op new ns/op delta
BenchmarkSingleStreamLargeResponseBody-8 17786594 12163494 -31.61%
benchmark old allocs new allocs delta
BenchmarkSingleStreamLargeResponseBody-8 17086 15869 -7.12%
benchmark old bytes new bytes delta
BenchmarkSingleStreamLargeResponseBody-8 58215169 21604391 -62.89%1 parent 42fe2e7 commit bd15c6b
2 files changed
+37
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | 13 | | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
206 | 208 | | |
207 | 209 | | |
208 | 210 | | |
209 | | - | |
210 | | - | |
211 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
141 | 149 | | |
142 | 150 | | |
143 | 151 | | |
| |||
367 | 375 | | |
368 | 376 | | |
369 | 377 | | |
370 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
371 | 381 | | |
372 | 382 | | |
373 | 383 | | |
| |||
385 | 395 | | |
386 | 396 | | |
387 | 397 | | |
388 | | - | |
389 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
390 | 409 | | |
391 | 410 | | |
392 | 411 | | |
| |||
421 | 440 | | |
422 | 441 | | |
423 | 442 | | |
424 | | - | |
425 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
426 | 452 | | |
427 | 453 | | |
428 | 454 | | |
| |||
0 commit comments