Commit 91cdbfe
committed
optimize: replace manual repetition loops with slice fill in decompressor
In \`read_dynamic_huffman_header\`, the loops used to repeat symbol lengths (codes 16, 17, and 18) were doing per-element assignments and bounds checks. Replacing these with \`slice::fill\` is more idiomatic and performant, as it allows the compiler to optimize the fill operation and avoids unnecessary branching. Safety is maintained by using \`min\` to clamp the fill length to the remaining number of symbols.1 parent 90c8d41 commit 91cdbfe
1 file changed
Lines changed: 9 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
471 | 468 | | |
472 | 469 | | |
473 | 470 | | |
474 | 471 | | |
475 | 472 | | |
476 | 473 | | |
477 | 474 | | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
484 | 478 | | |
485 | 479 | | |
486 | 480 | | |
487 | 481 | | |
488 | 482 | | |
489 | 483 | | |
490 | 484 | | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
497 | 488 | | |
498 | 489 | | |
499 | 490 | | |
| |||
0 commit comments