Commit 97a5bfd
authored
optimize: replace manual repetition loops with slice fill in decompressor (#428)
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 04905e8 commit 97a5bfd
1 file changed
Lines changed: 9 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
467 | 464 | | |
468 | 465 | | |
469 | 466 | | |
470 | 467 | | |
471 | 468 | | |
472 | 469 | | |
473 | 470 | | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
480 | 474 | | |
481 | 475 | | |
482 | 476 | | |
483 | 477 | | |
484 | 478 | | |
485 | 479 | | |
486 | 480 | | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
493 | 484 | | |
494 | 485 | | |
495 | 486 | | |
| |||
0 commit comments