mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:17:35 +00:00
AK: Rewrite the hint-based CircularBuffer::find_copy_in_seekback
This now searches the memory in blocks, which should be slightly more efficient. However, it doesn't make much difference (e.g. ~1% in LZMA compression) in most real-world applications, as the non-hint function is more expensive by orders of magnitude.
This commit is contained in:
parent
3526d67694
commit
42d01b21d8
4 changed files with 36 additions and 51 deletions
|
@ -998,10 +998,10 @@ ErrorOr<void> LzmaCompressor::encode_once()
|
|||
m_rep2 + normalized_to_real_match_distance_offset,
|
||||
m_rep3 + normalized_to_real_match_distance_offset,
|
||||
};
|
||||
auto existing_distance_results = TRY(m_dictionary->find_copy_in_seekback(existing_distances, m_dictionary->used_space(), normalized_to_real_match_length_offset));
|
||||
auto existing_distance_result = m_dictionary->find_copy_in_seekback(existing_distances, m_dictionary->used_space(), normalized_to_real_match_length_offset);
|
||||
|
||||
if (existing_distance_results.size() > 0) {
|
||||
auto selected_match = existing_distance_results[0];
|
||||
if (existing_distance_result.has_value()) {
|
||||
auto selected_match = existing_distance_result.release_value();
|
||||
TRY(encode_existing_match(selected_match.distance, selected_match.length));
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue