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

support LZ4_decompress_faster using statistics #61

Open
sundy-li opened this issue Dec 12, 2022 · 2 comments
Open

support LZ4_decompress_faster using statistics #61

sundy-li opened this issue Dec 12, 2022 · 2 comments

Comments

@sundy-li
Copy link

ClickHouse has implemented a fast lz4 decompress method using performance statistics.

Maybe it's a good approach to have it in lz4_flex crate.

@PSeitz
Copy link
Owner

PSeitz commented Dec 13, 2022

Thanks for the hint, that's pretty interesting.

They seem to use two parameters <size_t copy_amount, bool use_shuffle>, while copy_amount are 8, 16 and 32.

lz4_flex uses a wild_copy of 16 currently, but depending on the architecture, more or less might be good.
wild_copy will copy blocks of 16 bytes, event though the actual data required is less. That's possible when we are far enough from the end of the data (most of the time).
https://github.com/PSeitz/lz4_flex/blob/main/src/block/decompress.rs#L35-L46

I don't know yet what the shuffle is about.

@sundy-li
Copy link
Author

I don't know yet what the shuffle is about.

I don't know the detail either but looks like it will use some SIMD instructions to improve copy performance.

https://doc.rust-lang.org/beta/core/arch/x86_64/fn._mm_shuffle_epi8.html
https://doc.rust-lang.org/beta/core/arch/x86_64/fn._mm_loadu_si128.html

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

No branches or pull requests

2 participants