Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve safe decompression performance 8-18% #73

Merged
merged 3 commits into from
Feb 2, 2023
Merged

Improve safe decompression performance 8-18% #73

merged 3 commits into from
Feb 2, 2023

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