mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07: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
|
@ -75,7 +75,7 @@ public:
|
|||
/// Supplying any hints will only consider those distances, in case existing offsets need to be validated.
|
||||
/// Note that, since we only start searching at the read head, the length between read head and write head is excluded from the distance.
|
||||
ErrorOr<Vector<Match>> find_copy_in_seekback(size_t maximum_length, size_t minimum_length = 2) const;
|
||||
ErrorOr<Vector<Match>> find_copy_in_seekback(Vector<size_t> const& distances, size_t maximum_length, size_t minimum_length = 2) const;
|
||||
Optional<Match> find_copy_in_seekback(ReadonlySpan<size_t> distances, size_t maximum_length, size_t minimum_length = 2) const;
|
||||
|
||||
private:
|
||||
// Note: This function has a similar purpose as next_seekback_span, but they differ in their reference point.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue