Commit Graph

13 Commits

Author SHA1 Message Date
Andy Balholm 24b2bfad2d matchfinder.M4: add Score function 2024-01-02 13:38:12 -08:00
Andy Balholm 4a024e3eff matchfinder.M4: add match chain 2024-01-01 16:13:22 -08:00
Andy Balholm 63f3f4372d matchfinder.M4: add LimitedSearch option
Using LimitedSearch, it only checks for overlapping matches in one
place instead of checking at each byte.
This gains about 50% in compression speed while only losing about
2% in compression ratio.
2023-12-30 15:56:13 -08:00
Andy Balholm 349ed2fce1 Add matchfinder package.
I've been experimenting for a while with a new brotli compressor.
Instead of being a translation of the C implementation,
it's a rewrite in Go, with a modular structure thanks to interfaces.
(A few low-level functions still come from the C version, though.)

The performance is getting to the point where it seems to be worth
adding to the brotli repository.
2023-12-28 16:09:32 -08:00
Andy Balholm 2848168f55 Reader.Reset: recover from errors.
When a Reader encounters an error, its internal state may be corrupted.
So Reset needs to be extra thorough, to avoid cascading errors.

Based on PR 37 by Sovianum.
2022-09-23 19:39:05 -07:00
Andy Balholm 786ec621f6 Reuse ringbuffer in Reader.
Fixes #33
2022-05-18 12:06:45 -07:00
Andy Balholm 177b8acd6c Add test for issue 22. 2021-07-15 12:01:31 -07:00
Andy Balholm 8f8b18645c Read multiple bytes in findMatchLengthWithLimit
Use 64- or 32-bit loads instead of reading a byte at a time. The
original C source did something like this, in a very C-ish way. It
needed to be simplified to translate it to Go. The exact way this works
was suggested by the assembly code in github.com/golang/snappy.
2020-05-15 10:43:19 -07:00
Andy Balholm 511ca97d30 Benchmark all compression levels. 2020-05-06 16:08:01 -07:00
Andy Balholm cb9be97eb7 Reuse more memory when a Writer is Reset. 2020-05-05 17:18:33 -07:00
Andy Balholm ed0fd64940 Fix int overflow in test on 32-bit.
On 32-bit systems, the random array indexes were sometimes negative as a
result of converting an int64 to int.

Fixes #7.
2019-07-25 08:52:43 -07:00
Andy Balholm f00818cf36 Fix tests broken by API change. 2019-04-25 09:03:32 -07:00
Andy Balholm 0da14edee1 Make BrotliDecoderState into a Reader. 2019-03-06 17:08:24 -08:00