Commit graph

24 commits

Author SHA1 Message Date
Timothy Flynn
c911781c21 Everywhere: Remove needless trailing semi-colons after functions
This is a new option in clang-format-16.
2023-07-08 10:32:56 +01:00
Tim Schumacher
60ac254df6 AK: Use hashing to accelerate searching a CircularBuffer 2023-07-06 15:06:20 +01:00
Tim Schumacher
42d01b21d8 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.
2023-07-06 15:06:20 +01:00
Tim Schumacher
046a9faeb3 AK: Split up CircularBuffer::find_copy_in_seekback
The "operation modes" of this function have very different focuses, and
trying to combine both in a way where we share the most amount of code
probably results in the worst performance.

Instead, split up the function into "existing distances" and "no
existing distances" so that we can optimize either case separately.
2023-07-06 15:06:20 +01:00
Tim Schumacher
9e82ad758e AK: Move parts for searching CircularBuffer into a new class
We will be adding extra logic to the CircularBuffer to optimize
searching, but this would negatively impact the performance of
CircularBuffer users that don't need that functionality.
2023-07-06 15:06:20 +01:00
Tim Schumacher
d4b0e64825 LibCompress: Move two shared LZMA magic numbers into a common place 2023-05-19 23:40:33 +02:00
Tim Schumacher
a01968ee6d LibCompress: Handle arbitrarily long FF-chains in the LZMA encoder 2023-05-19 23:40:33 +02:00
Tim Schumacher
cb93186350 LibCompress: Add debug logging for handling LZMA direct bits 2023-05-19 23:40:33 +02:00
Tim Schumacher
df071d8a76 LibCompress: Add a lot of debug logging to LZMA 2023-05-17 09:08:53 +02:00
Tim Schumacher
85a54cc796 LibCompress: Add an LZMA encoder 2023-05-17 09:08:53 +02:00
Tim Schumacher
9ab3646bc7 LibCompress: Use the variable for LZMA "normalized to real distance"
The variable already existed, but I forgot to use it earlier.
2023-05-17 09:08:53 +02:00
Tim Schumacher
42514c6961 LibCompress: Decode the LZMA match type in a separate function
This should keep the `read_some` function a bit flatter and shorter, and
make it easier to match the match type decoding process with the
specification.
2023-05-17 09:08:53 +02:00
Tim Schumacher
4a37bac374 LibCompress: Make LzmaHeader a POD-like type
This allows us to initialize the struct using an aggregate initializer.
2023-05-17 09:08:53 +02:00
Tim Schumacher
440d8f908f LibCompress: Extract the LZMA state to a separate class
We will also need this in the compressor, as it needs to do the exact
same calculations in reverse.
2023-05-17 09:08:53 +02:00
Tim Schumacher
7000ccf89f LibCompress: Copy LZMA repetitions from the buffer in sequence
This improves the decompression time of `clang-15.0.7.src.tar.xz` from
5.2 seconds down to about 2.7 seconds.
2023-04-05 07:30:38 -04:00
Tim Schumacher
fe761a4e9b LibCompress: Use LZMA context from preexisting dictionary 2023-03-30 14:39:31 +02:00
Tim Schumacher
023c64011c LibCompress: Use the correct LZMA repetition offset in all cases 2023-03-30 14:39:31 +02:00
Tim Schumacher
d9627503a9 LibCompress: Reduce repeated code in the LZMA decompressor 2023-03-30 14:39:31 +02:00
Tim Schumacher
8ff36e5910 LibCompress: Implement proper handling of LZMA end-of-stream markers 2023-03-30 08:45:35 +02:00
Tim Schumacher
b6f3b2f116 LibCompress: Move common LZMA end-of-file checks into helper functions 2023-03-30 08:45:35 +02:00
Tim Schumacher
1b8318ab67 LibCompress: Allow providing an external dictionary for LZMA
While at it, rename the former "output buffer" to "dictionary", since
that's its primary function.
2023-03-21 10:25:13 +01:00
Tim Schumacher
f4506a3a72 LibCompress: Allow appending input streams to an existing LZMA decoder 2023-03-21 10:25:13 +01:00
Tim Schumacher
04f69de7f1 LibCompress: Refactor LZMA model property decoding into a static helper 2023-03-21 10:25:13 +01:00
Tim Schumacher
b3a9729e23 LibCompress: Add support for LZMA streams 2023-03-20 12:15:38 +02:00