Skip to content

Improve safe decompression performance 8-18%#73

Merged
PSeitz merged 3 commits intomainfrom
the_real_main
Feb 2, 2023
Merged

Improve safe decompression performance 8-18%#73
PSeitz merged 3 commits intomainfrom
the_real_main

Conversation

@PSeitz
Copy link
Owner

@PSeitz PSeitz commented Feb 2, 2023

Improve safe decompression speed by 8-18%

Reduce multiple slice fetches. every slice access, also nested ones
,carries some overhead. In the hot loop a fixed &[u8;16] is fetched to
operate on. This is purely done to pass that info to the compiler.

Remove error handling that only carries overhead. As we are in safe
mode we can rely on bounds checks if custom error handling only adds overhead.
In normal operation no error should occur.

The strategy to identify improvements was by counting the lines of
assembly. A rough heuristic, but seems effective.
cargo asm --release --example decompress_block decompress_block::main |
wc -l

those assertions are only used in safe code and therefore unnecessary
Improve safe decompression speed by 8-18%

Reduce multiple slice fetches. every slice access, also nested ones
,carries some overhead. In the hot loop a fixed &[u8;16] is fetched to
operate on. This is purely done to pass that info to the compiler.

Remove error handling that only carries overhead. As we are in safe
mode we can rely on bounds checks if custom error handling only adds overhead.
In normal operation no error should occur.

The strategy to identify improvements was by counting the lines of
assembly. A rough heuristic, but seems effective.
cargo asm --release --example decompress_block decompress_block::main |
wc -l
@PSeitz PSeitz merged commit cf49b16 into main Feb 2, 2023
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