Reduce usage of variable cpy on decompression #1226
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello, I hope you are doing well
I wanted to propose an additional code optimization for the decompression function:
The variable cpy is now not used from the code paths that copy literals within the fast decompression loop.
This optimizes the usage of the CPU registers, as well as reduces the size of certain code branches.
On average, I got slightly over 1% improvement in decompression speed when decompressing the Silesia corpus using an X64 CPU.
This optimization works very well with the one proposed in the PR "Optimize LZ4_memcpy_using_offset".
When both optimizations are applied together, the usage of the variable cpy is completely removed from the fast decompression loop.
Regards,
Nicolas