AK: Search CircularBuffer matches from the end of memory#26527
AK: Search CircularBuffer matches from the end of memory#26527timschumi merged 2 commits intoSerenityOS:masterfrom
Conversation
nico
left a comment
There was a problem hiding this comment.
Any observable changes in the filesizes produced by tar -c --lzma with this?
|
So 2? |
Sorry, yeah, it's effectively |
|
Found a bunch of other issues in other places that may affect this PR, will draft until I fixed those. |
47f3ea9 to
554e426
Compare
|
Applying the forward/reverse preference to the whole size range (instead of just the ones covered by non-hash search) indeed creates a noticeable size difference: Do note that in all cases (that I remember) we still pick the optimal match length-wise, so this size difference should be created purely by said distance encoding. I'll clean up a few other issues beforehand separately and then open this PR back up for review. |
This is particularly useful for compression, where we want to search through the lookback buffer for the smallest possible distance [towards the end].
This is generally advantageous for compression algorithms.
554e426 to
6c29868
Compare
This is particularly useful for compression, where we want to search through the lookback buffer for the smallest possible distance [towards the end].
Do note that the new
AK::memmem_reversehas somewhat unexpected semantics around what an "offset" is, matching the very last character of the memory range with a needle of size 1 would yield the offset 1. Please check the test files for more examples of this. Would love to hear some opinions about that, but I can't figure out how to solve it any better way.