Pure Go Brotli encoder and decoder
Go to file
Erik Dubbelboer a01a7b12c9 Reuse buffers and objects using sync.Pool
This reduces the amount of garbage generated and relieves pressure on
the GC.

For a workload without reusing the Writer (using Writer.Reset) the number of allocations goes from 31 to 9.
While for a workload when you reuse the Writer the number of allocations goes from 25 to 0.
2020-05-10 10:36:19 +02:00
testdata Benchmark all compression levels. 2020-05-06 16:08:01 -07:00
LICENSE Add LICENSE. 2019-03-06 17:11:20 -08:00
README.md Add README. 2019-06-21 08:47:22 -07:00
backward_references.go Reuse buffers and objects using sync.Pool 2020-05-10 10:36:19 +02:00
backward_references_hq.go Use len and cap instead of num_commands_ and cmd_alloc_size_. 2020-05-08 16:48:16 -07:00
bit_cost.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
bit_reader.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
block_splitter.go Reuse buffers and objects using sync.Pool 2020-05-10 10:36:19 +02:00
block_splitter_command.go Use len and cap instead of num_commands_ and cmd_alloc_size_. 2020-05-08 16:48:16 -07:00
block_splitter_distance.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
block_splitter_literal.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
brotli_bit_stream.go Reuse buffers and objects using sync.Pool 2020-05-10 10:36:19 +02:00
brotli_test.go Benchmark all compression levels. 2020-05-06 16:08:01 -07:00
cluster.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
cluster_command.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
cluster_distance.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
cluster_literal.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
command.go Use len and cap instead of num_commands_ and cmd_alloc_size_. 2020-05-08 16:48:16 -07:00
compress_fragment.go Use const for constants. 2019-03-21 16:15:39 -07:00
compress_fragment_two_pass.go Fix negative slice indexes. 2019-03-23 11:17:03 -07:00
constants.go Un-export some more symbols 2019-03-15 17:24:40 -07:00
context.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
decode.go Fix warnings from go vet. 2019-03-26 06:05:46 -04:00
dictionary.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
dictionary_hash.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
encode.go Reuse buffers and objects using sync.Pool 2020-05-10 10:36:19 +02:00
encoder_dict.go Finish un-exporting symbols. 2019-03-15 18:00:20 -07:00
entropy_encode.go Revert "Use sort.Sort to sort Huffman trees." 2020-05-08 13:52:56 -07:00
entropy_encode_static.go Finish un-exporting symbols. 2019-03-15 18:00:20 -07:00
fast_log.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
find_match_length.go A couple of tweaks 2020-05-04 16:09:27 -07:00
go.mod Copy negotiateContentEncoding. 2019-08-21 08:13:43 -07:00
go.sum Copy negotiateContentEncoding. 2019-08-21 08:13:43 -07:00
h5.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
h6.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
h10.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
hash.go Use const for constants. 2019-03-21 16:15:39 -07:00
hash_composite.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
hash_forgetful_chain.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
hash_longest_match_quickly.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
hash_rolling.go Use const for constants. 2019-03-21 16:15:39 -07:00
histogram.go Use len and cap instead of num_commands_ and cmd_alloc_size_. 2020-05-08 16:48:16 -07:00
http.go Copy negotiateContentEncoding. 2019-08-21 08:13:43 -07:00
huffman.go Fix warnings from go vet. 2019-03-26 06:05:46 -04:00
literal_cost.go Finish un-exporting symbols. 2019-03-15 18:00:20 -07:00
memory.go Reuse buffers and objects using sync.Pool 2020-05-10 10:36:19 +02:00
metablock.go Reuse buffers and objects using sync.Pool 2020-05-10 10:36:19 +02:00
metablock_command.go Reuse buffers and objects using sync.Pool 2020-05-10 10:36:19 +02:00
metablock_distance.go Reuse buffers and objects using sync.Pool 2020-05-10 10:36:19 +02:00
metablock_literal.go Reuse buffers and objects using sync.Pool 2020-05-10 10:36:19 +02:00
params.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
platform.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
prefix.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
prefix_dec.go Finish un-exporting symbols. 2019-03-15 18:00:20 -07:00
quality.go Finish un-exporting symbols. 2019-03-15 18:00:20 -07:00
reader.go Merge pull request #4 from paolobarbolini/behave-like-compress 2019-04-25 09:01:22 -07:00
ringbuffer.go Reuse buffers and objects using sync.Pool 2020-05-10 10:36:19 +02:00
state.go Finish un-exporting symbols. 2019-03-15 18:00:20 -07:00
static_dict.go Use const for constants. 2019-03-21 16:15:39 -07:00
static_dict_lut.go Use const for constants. 2019-03-21 16:15:39 -07:00
symbol_list.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
transform.go Fix warnings from go vet. 2019-03-26 06:05:46 -04:00
utf8_util.go Use const for constants. 2019-03-21 16:15:39 -07:00
util.go Use some Go library functions. 2019-03-08 19:45:16 -08:00
write_bits.go Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
writer.go Push output directly to dst instead of buffering. 2020-05-07 17:27:37 -07:00

README.md

This package is a brotli compressor and decompressor implemented in Go. It was translated from the reference implementation (https://github.com/google/brotli) with the c2go tool at https://github.com/andybalholm/c2go.

I am using it in production with https://github.com/andybalholm/redwood.