Commit Graph

23 Commits

Author SHA1 Message Date
Andy Balholm 94609f9606 Revert "Faster bit writing."
This reverts commit c3da72aa01.

With the sample data from issue 22, one byte in the output file is zero
instead of the correct value. For now at least, we'll go back to the old
way of writing bits.

Fixes #22
2021-04-27 10:48:28 -07:00
Andy Balholm c3da72aa01 Faster bit writing.
Replace the functions in write_bits.go with a bitWriter type based on
the compress/flate package.
2020-06-18 18:58:27 -07:00
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
Andy Balholm e2c5f2109f Use len and cap instead of num_commands_ and cmd_alloc_size_. 2020-05-08 16:48:16 -07:00
Andy Balholm 4b2775ea5e Fix some ugly compound literals. 2020-05-08 15:14:47 -07:00
Andy Balholm 7c7a5a10ef Push output directly to dst instead of buffering. 2020-05-07 17:27:37 -07:00
Andy Balholm 625cbb6f92 Replace storage_size_ with len(storage). 2020-05-07 15:40:58 -07:00
Andy Balholm f41712f811 Remove unnecessary parameters from encodeData.
The pointers passed to out_size and output were always the same,
so there is no need to have them as parameters.

Based on
00ca10b927
and b3ee528567
2020-05-06 17:20:27 -07:00
Andy Balholm 2c14228f02 Preserve w.commands across Reset. 2020-05-05 17:36:16 -07:00
Andy Balholm cb9be97eb7 Reuse more memory when a Writer is Reset. 2020-05-05 17:18:33 -07:00
Andy Balholm 71eb68cc46 Preserve compression settings when Writer is reset.
Fixes #6
2019-07-04 08:13:24 -07:00
Andy Balholm 36f6c9721d Fix warnings from go vet.
FIxes #1
2019-03-26 06:05:46 -04:00
Andy Balholm 08371dc992 Use const for constants. 2019-03-21 16:15:39 -07:00
Andy Balholm 52165d4974 Clean up duplicate and misplaced comments. 2019-03-21 15:34:30 -07:00
Andy Balholm 55e85f3f75 Finish un-exporting symbols. 2019-03-15 18:00:20 -07:00
Andy Balholm 7b66c0a2f2 Un-export some more symbols 2019-03-15 17:24:40 -07:00
Andy Balholm 906c822ef2 Un-export more symbols 2019-03-15 12:05:31 -07:00
Andy Balholm 5001b3d0d7 Start un-exporting names. 2019-03-09 17:11:32 -08:00
Andy Balholm d6c7de28d1 Simplify encoder interface to match what is used by Write. 2019-03-09 15:57:44 -08:00
Andy Balholm 7ed41e6356 Change more hasher functions to methods. 2019-03-08 16:43:15 -08:00
Andy Balholm bbbdedf380 Start converting hasher functions to methods. 2019-03-08 15:10:41 -08:00
Andy Balholm f036cd04c1 Make BrotliEncoderState into a Writer. 2019-03-06 16:16:48 -08:00
Andy Balholm 69a32ecc1a Initial commit.
This is the output of c2go, except for util.go.
2019-03-06 14:55:38 -08:00