Frommi / miniz_oxide

Rust replacement for miniz
MIT License
168 stars 48 forks source link

Code size reduction from panic reduction #145

Closed kornelski closed 5 months ago

kornelski commented 5 months ago

Manual bounds checks optimize better, because they don't have additional side effects, and don't need to set a unique panic location each time.

input = &input[in_consumed..] optimizes better than advancing in_pos.

There's a ton more panics in decompress.

oyvindln commented 5 months ago

Thanks, any measurements?

I've not really done much work on this being busy with other projects for the last few years and @Frommi has been nowhere to be seen so there's probably a lot of room for optimization and improvement with updates to Rust in the meantime.

kornelski commented 5 months ago

I'm using cargo-show-asm to verify, and for example init_tree has 20% fewer instructions.