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 unrolling wildCopy32 into wildCopy64: a function that copies memory in chunks of 64 bytes.
The intent is to improve branch prediction by halving the amount of execution forks.
FASTLOOP_SAFE_DISTANCE is already defined as 64, so there are minimal changes in the control flow.
Tested it in two scenarios:
Scenario 1:
CPU: Ryzen 5900X
Compilers: gcc-11, clang-8.
Files: enwik9, each file within the silesia corpus, a custom memory dump retrieved from my PC.
Results: Decompression throughput improved in all combinations of files and compilers.
Scenario 2:
CPU: i5-1245U
Compilers: gcc-[9-12], clang-[11-14].
Files: enwik9, 'xml' from the silesia corpus, the custom memory dump retrieved from my PC.
Results: Decompression throughput improved in all combinations of files and compilers.
The improvement percentage varies depending on the file, compiler and CPU measured.
The data seems to suggest that the improvement yielded by the change overcomes the effects of instruction alignment.
Hopefully, your test scenarios show similar results.
There are other unrolling optimizations that can be done, but maybe it's better to test them one at a time.
I'll propose them after deciding whether or not to merge this one.
Cheers,
Nicolas